Cant rebuild My electron App After Installing sqlite3 module - node.js

When I am trying to rebuild my code with the command "electron-rebuild -f -w sqlite3". I am getting this error on windows.
An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp#3.7.0
gyp info using node#8.11.3 | win32 | x64
gyp http GET https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http 200 https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http GET https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http GET https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node- gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\App\\node_modules\\sqlite3\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\company ismi\\.electron-gyp\\.node- gyp\\iojs-2.0.5\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\company ismi\\.electron- gyp\\.node-gyp\\iojs-2.0.5',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\company ismi\\.electron- gyp\\.node-gyp\\iojs-2.0.5\\<(target_arch)\\iojs.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\App\\node_modules\\sqlite3',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\App\\node_modules\\sqlite3\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\App\node_modules\sqlite3\build\deps\action_before_build.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\node- gyp\lib\build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.5" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=C:\\App\\node_modules\\sqlite3\\lib\\binding\\electron-v2.0-win32-x64" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.2/{toolset}/" "--package_name=electron-v2.0-win32-x64.tar.gz"
gyp ERR! cwd C:\App\node_modules\sqlite3
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Failed with exit code: 1
Error: gyp info it worked if it ends with ok
gyp info using node-gyp#3.7.0
gyp info using node#8.11.3 | win32 | x64
gyp http GET https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http 200 https://atom.io/download/electron/v2.0.5/iojs-v2.0.5.tar.gz
gyp http GET https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http GET https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http GET https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/SHASUMS256.txt
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x64/iojs.lib
gyp http 200 https://atom.io/download/electron/v2.0.5/win-x86/iojs.lib
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\company
ismi\\AppData\\Roaming\\npm\\node_modules\\electron-
rebuild\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\App\\node_modules\\sqlite3\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node- gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\company ismi\\.electron-gyp\\.node- gyp\\iojs-2.0.5\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\company ismi\\.electron- gyp\\.node-gyp\\iojs-2.0.5',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\company ismi\\AppData\\Roaming\\npm\\node_modules\\electron-rebuild\\node_modules\\node- gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\company ismi\\.electron-gyp\\.node-gyp\\iojs-2.0.5\\<(target_arch)\\iojs.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\App\\node_modules\\sqlite3',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\App\\node_modules\\sqlite3\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\App\node_modules\sqlite3\build\deps\action_before_build.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--target=2.0.5" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=C:\App\node_modules\sqlite3\lib\binding\electron-v2.0-win32-x64" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.2/{toolset}/" "--package_name=electron-v2.0-win32-x64.tar.gz"
gyp ERR! cwd C:\App\node_modules\sqlite3
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Failed with exit code: 1
at SafeSubscriber._error (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\spawn-rx\lib\src\index.js:277:84)
at SafeSubscriber.__tryOrUnsub (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:242:16)
at SafeSubscriber.error (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:201:26)
at Subscriber._error (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:132:26)
at Subscriber.error (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:106:18)
at MapSubscriber.Subscriber._error (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:132:26)
at MapSubscriber.Subscriber.error (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:106:18)
at SafeSubscriber._next (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\spawn-rx\lib\src\index.js:251:65)
at SafeSubscriber.__tryOrUnsub (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:242:16)
at SafeSubscriber.next (C:\Users\company ismi\AppData\Roaming\npm\node_modules\electron-rebuild\node_modules\rxjs\Subscriber.js:189:22)
How do i fix that. But The same application is working fine under the Mac System.
Please Guide me to fix this error.

Are you trying to build for both x86 and x64 arch? And please format the question correctly. Looks like node-gyp is using some data from local cache. Have you tried cleaning AppData folder?

What I would do:
Go to the folder where sqlite3 is located e.g. ./node_modules/sqlite3 .
Ensure that for MS Windows you have installed the visual studio compiler and python.
Edit ./node_modules/sqlite3/package.json and add a new entry in the scripts section:
"build_vcust": "node-pre-gyp rebuild --target=X.X.X --arch=x64 --dist-url=https://atom.io/download/electron --msvs_version=2015"
Note: Replace X.X.X with your electron version.
From the sqlite3 folder execute "npm run build_vcust".
Learn more at (reference): https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md

Related

gyp errors when trying to install Parcel with NPM

I'm trying to install Parcel, I used both NPM and Yarn, and tried several Node.js versions (14, 16, 10...) but nothing worked for me, I always get the same error. I'm using Windows 10 32bit and Python
gyp info it worked if it ends with ok
gyp info using node-gyp#8.2.0
gyp info using node#16.13.0 | win32 | ia32
gyp info find Python using Python version 3.11.0 found at \"C:\\Users\\ALI\\AppData\\Local\\Programs\\Python\\Python311-32\\python.exe\"
gyp info find VS using VS2017 (15.9.28307.1831) found at:
gyp info find VS \"C:\\Program Files\\Microsoft Visual Studio\\2017\\BuildTools\"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\\Users\\ALI\\AppData\\Local\\Programs\\Python\\Python311-32\\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\gyp\\\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-I',
gyp info spawn args 'C:\\\\Users\\\\ALI\\\\Desktop\\\\osamasoliman\\\\node_modules\\\\msgpackr-extract\\\\build\\\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\\\Users\\\\ALI\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.0\\\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\\\Users\\\\ALI\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.13.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\\\\\Users\\\\\\\\ALI\\\\\\\\AppData\\\\\\\\Local\\\\\\\\node-gyp\\\\\\\\Cache\\\\\\\\16.13.0\\\\\\\\<(target_arch)\\\\\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\\\Users\\\\ALI\\\\Desktop\\\\osamasoliman\\\\node_modules\\\\msgpackr-extract',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\\\Users\\\\ALI\\\\Desktop\\\\osamasoliman\\\\node_modules\\\\msgpackr-extract\\\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp: C:\\Users\\ALI\\AppData\\Local\\node-gyp\\Cache\\16.13.0\\common.gypi not found (cwd: C:\\Users\\ALI\\Desktop\\osamasoliman\\node_modules\\msgpackr-extract) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\lib\\configure.js:353:16)
gyp ERR! stack at ChildProcess.emit (node:events:390:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command \"C:\\\\Program Files\\\\nodejs\\\\node.exe\" \"C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"rebuild\"
gyp ERR! cwd C:\\Users\\ALI\\Desktop\\osamasoliman\\node_modules\\msgpackr-extract
gyp ERR! node -v v16.13.0
gyp ERR! node-gyp -v v8.2.0
gyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error
PS C:\Users\ALI\Desktop\osamasoliman>
Are you sure that is installed all correctly?
Here it says that he did not found this:
C:\Users\ALI\AppData\Local\node-gyp\Cache\16.13.0\common.gypi not found
See if you can install another packages. If not, try to re-install

node-rdkafka installation failing with Permission Denied error

I have forked github.com/node-rdkafka and using it to consume node-rdkafka package in my nodejs service.
When I try to install the package, it fails with permission denied error on MacOS. Any ideas on how to fix it? I'm using Node=14.17.6, npm = 6.14.15.
Error log for npm i (same error with yarn):
# This file contains the result of Yarn building a package (node-rdkafka#https://github.com/forkedRepo/node-rdkafka.git#commit=<commitId>)
# Script name: install
gyp info it worked if it ends with ok
gyp info using node-gyp#8.4.1
gyp info using node#14.17.3 | darwin | x64
gyp info find Python using Python version 3.10.6 found at "/usr/local/opt/python#3.10/bin/python3.10"
gyp info spawn /usr/local/opt/python#3.10/bin/python3.10
gyp info spawn args [
gyp info spawn args '/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-rdkafka/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/testfolder/Library/Caches/node-gyp/14.17.3/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/testfolder/Library/Caches/node-gyp/14.17.3',
gyp info spawn args '-Dnode_gyp_dir=/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/testfolder/Library/Caches/node-gyp/14.17.3/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-rdkafka',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
ACTION deps_librdkafka_gyp_librdkafka_target_configure deps/librdkafka/config.h
/bin/sh: ./configure: Permission denied
Command failed: ./configure --prefix=/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-rdkafka/build/deps --libdir=/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-rdkafka/build/deps
make: *** [deps/librdkafka/config.h] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:375:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/testfolder/.nvm/versions/node/v14.17.3/bin/node" "/Users/testfolder/Documents/Repos/repo1/main/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/testfolder/Documents/Repos/repo1/main/node_modules/node-rdkafka
gyp ERR! node -v v14.17.3
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok

Need to solve yarn install error: fatal error: 'napi.h' file not found

I upgraded node version 12 to 14.20.0, and Angular CLI 9 to 14.0.7
I use MacOS Monterey 12.5, M1 chip
When I run the command yarn clean:npm && yarn install, I got this error.
I tried yarn add command for not found node-modules, and nothing changed.
$yarn install
Error
warning Error running install script for optional dependency: "/Users/myName/projects/popopo/projectName/frontend/node_modules/nice-napi: Command failed.
Exit code: 1
Command: node-gyp-build
Arguments:
Directory: /Users/myName/projects/popopo/projectName/frontend/node_modules/nice-napi
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp#8.1.0
gyp info using node#14.20.0 | darwin | arm64
gyp info find Python using Python version 3.10.4 found at \"/Users/myName/.anyenv/envs/pyenv/versions/3.10.4/bin/python3\"
gyp info spawn /Users/myName/.anyenv/envs/pyenv/versions/3.10.4/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/myName/projects/popopo/projectName/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/myName/projects/popopo/projectName/frontend/node_modules/nice-napi/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/myName/projects/popopo/projectName/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/myName/Library/Caches/node-gyp/14.20.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/myName/Library/Caches/node-gyp/14.20.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/myName/projects/popopo/projectName/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/myName/Library/Caches/node-gyp/14.20.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/myName/projects/popopo/projectName/frontend/node_modules/nice-napi',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
LIBTOOL-STATIC Release/nothing.a
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
CXX(target) Release/obj.target/nice_napi/binding.o
/bin/sh: pathos/projectName/frontend/node_modules/node-addon-api: No such file or directory
make: *** [Release/obj.target/nice_napi/binding.o] Error 127
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/myName/projects/popopo/projectName/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:285:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command \"/Users/myName/.anyenv/envs/nodenv/versions/14.20.0/bin/node\" \"/Users/myName/projects/popopo/projectName/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /Users/myName/projects/popopo/projectName/frontend/node_modules/nice-napi
gyp ERR! node -v v14.20.0
gyp ERR! node-gyp -v v8.1.0
gyp ERR! not ok
../binding.cc:1:10: fatal error: 'napi.h' file not found
✨ Done in 127.04s.

Node ldap-client installation error

I tried installing the ldap-client node module for nodejs on my local windows machine by running this command, npm install --save ldap-client.
It gives the error as attached
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\workspace\AJNSDemoProject
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
I installed the OpenLDAP client libraries from here (http://www.openldap.org/software/download/) as tgz and extracted that and put the folder in my project root folder.
I am using latest node version 8.10.0
Could you please advice whats wrong in my case?
Thanks
Debug log when run "node-gyp rebuild" command
C:\workspace\AJNSDemoProject>node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp#3.6.2
gyp info using node#8.10.0 | win32 | x64
gyp info spawn C:\Program Files (x86)\Python\python.exe
gyp info spawn args [ 'C:\\Users\\niyaza.fazlullah\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\workspace\\AJNSDemoProject\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\niyaza.fazlullah\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\niyaza.fazlullah\\.node-gyp\\8.10.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\niyaza.fazlullah\\.node-gyp\\8.10.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\niyaza.fazlullah\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\niyaza.fazlullah\\.node-gyp\\8.10.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\workspace\\AJNSDemoProject',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\workspace\\AJNSDemoProject\\build',
gyp info spawn args '-Goutput_dir=.' ]
Warning: Missing input files:
C:\workspace\AJNSDemoProject\build\..\src\binding.cc
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
binding.cc
c1xx : fatal error C1083: Cannot open source file: '..\src\binding.cc': No such file or directory [C:\workspace\AJNSDem
oProject\build\binding.vcxproj]
win_delay_load_hook.cc
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\niyaza.fazlullah\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\niyaza.fazlullah\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\workspace\AJNSDemoProject
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

Can't rebuild node-opencv with nw-gyp

I'm trying to rebuild node-opencv for use with node-webkit. To do this you need to use nw-gyp but I'm running into some errors. Could you give me any insight into why this might be?
[~/nw_cv/node_modules/opencv] nw-gyp rebuild --target=0.9.2
gyp info it worked if it ends with ok
gyp info using nw-gyp#0.12.2
gyp info using node#0.10.26 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/node_modules/nw-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/moog/nw_cv/node_modules/opencv/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/nw-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/moog/.nw-gyp/0.9.2/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/moog/.nw-gyp/0.9.2',
gyp info spawn args '-Dmodule_root_dir=/Users/moog/nw_cv/node_modules/opencv',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/opencv/src/init.o
In file included from ../src/init.cc:2:
../src/Point.h:13:59: error: unknown type name 'AccessorInfo'
static Handle<Value> GetX(Local<String> prop, const AccessorInfo &info);
^
../src/Point.h:14:59: error: unknown type name 'AccessorInfo'
static Handle<Value> GetY(Local<String> prop, const AccessorInfo &info);
^
../src/Point.h:15:84: error: unknown type name 'AccessorInfo'
static void RaiseImmutable(Local<String> property, Local<Value> value, const AccessorInfo& info);
^
3 errors generated.
make: *** [Release/obj.target/opencv/src/init.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/nw-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/bin/nw-gyp" "rebuild" "--target=0.9.2"
gyp ERR! cwd /Users/moog/nw_cv/node_modules/opencv
gyp ERR! node -v v0.10.26
gyp ERR! nw-gyp -v v0.12.2
gyp ERR! not ok
Thanks!
As you can see compiler can't find type AccessorInfo. That's because there is no more such class in v8 API. node-webkit v0.9.2 is based on node 0.11.x branch, so some native addons might not compile or work correctly because of v8 API changes. You need to use node-webkit 0.8.x branch is these cases.

Resources