I have a problem installing sqlite3 with npm in windows for an electron app.
I installed sqlite3 with npm:
npm i sqlite3
Then I executed:
.\node_modules\.bin\electron-rebuild.cmd
And I have this error:
× Rebuild Failed
An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp#3.8.0
gyp info using node#8.12.0 | win32 | x64
gyp http GET https://atom.io/download/electron/v2.0.10/iojs-v2.0.10.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: getaddrinfo EAI_AGAIN atom.io:443
gyp ERR! stack at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\WindowsDev\\CopyWatcher\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=D:\\WindowsDev\\CopyWatcher\\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 D:\WindowsDev\CopyWatcher\node_modules\sqlite3
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Everything seems to indicate that it is the proxy, I have it configured well in .npmrc, but it does not work in this case, so I try to execute the command that launches electron-rebuild with the option --proxy:
"C:\\Program Files\\nodejs\\node.exe" "D:\\WindowsDev\\CopyWatcher\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=D:\\WindowsDev\\CopyWatcher\\node_modules\\sqlite3\\lib\\binding\\electron-v2.0-win32-x64" "--proxy=http://127.0.0.1:3131/" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.2/{toolset}/" "--package_name=electron-v2.0-win32-x64.tar.gz"
But then I have this error:
gyp: binding.gyp not found (cwd: D:\WindowsDev\CopyWatcher) 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 (D:\WindowsDev\CopyWatcher\node_modules\node-gyp\lib\configure.js:345:16)
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.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\WindowsDev\\CopyWatcher\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=D:\\\\WindowsDev\\\\CopyWatcher\\\\node_modules\\\\sqlite3\\\\lib\\\\binding\\\\electron-v2.0-win32-x64" "--proxy=http://127.0.0.1:3131/" "--host=https://mapbox-node-binary.s3.amazonaws.com" "--remote_path=./{name}/v4.0.2/{toolset}/" "--package_name=electron-v2.0-win32-x64.tar.gz"
It seems that it looks for a file named "binding.gyp" but it is not and I do not know where it should be or what it must have to work.
Some help?
Thanks in advance.
So, here are the steps that make it work:
First remove your node_modules folder and package-lock.json
and follow below steps
install electron-rebuild
npm install --save-dev electron-rebuild
install sqlite3 using npm
npm install --save sqlite3
rebuild electron with sqlite3. In package.json scripts section, add:
"rebuild": "electron-rebuild -f -w sqlite3"
run the following command
npm run rebuild
Now, you’ll get another binding, something like:
/.../node_modules/sqlite3/lib/binding/electron-v1.4-darwin-x64/node_sqlite3.node
which is accepted by electron.
Related
I am trying to install sqlite3 to make an app in Electron over Windows. I put in my package.json:
"rebuild": "electron-rebuild -f -w sqlite3"
When I run:
npm run rebuild
I get this error:
Error: The projects of this solution will be compiled one at a time. To enable compilation in parallel, add the "/ m" switch.
D:\WindowsDev\CopyWatcher\node_modules\sqlite3\build\deps\action_before_build.vcxproj(20,3): error MSB4019: The imported project "D: \ Microsoft.Cpp.Default.props" can not be found. Make sure that the path of the <Import> declaration is correct and that the file is on the 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 (D:\WindowsDev\CopyWatcher\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.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\WindowsDev\\CopyWatcher\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=2.0.10" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source" "--module_name=node_sqlite3" "--module_path=D:\\WindowsDev\\CopyWatcher\\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 D:\WindowsDev\CopyWatcher\node_modules\sqlite3
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
I install Visual Studio Developer Tools 2015 and sqlite3 module works well!
Im trying to install this module with NPM install:
https://www.npmjs.com/package/node-adwords-es5
Somehow im getting a bunch of errors in git bash. See them here below:
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 6.3.9600
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\kevin\Desktop\adwordsapi\node_modules\ursa
gyp ERR! node -v v6.10.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
It did install my package tho. Are those errors crucial for further development? I'm just starting out with nodeJS. I hope you can help me, if this has any issues for further development id like to know how to solve this.
Thanks in advance
Since I can't comment :(
It's a known issue with node-gyp.
Try following the thread here
Also check the answer here
I'm trying to compile a native node module using
npm i
This fails with error
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:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
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:\bitbucket\node\native_modules
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
However, if I run the node-gyp command manually with
node-gyp rebuild
Then it works fine.
I notice that node-gyp --version returns v3.6.0 whereas in the error message above it's running v3.4.0.
How do I update npm to use the newer version (which seems to work ok)?
Also, why would this be failing on the old version?
I tried the instructions here https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp they don't seem to work. I'm on Windows 10.
I have this working now. Here's what I did:
Open a command prompt (run as administrator). cd to the node installation folder, then run:
C:\Program Files\nodejs\node_modules\npm>npm uninstall node-gyp --save
C:\Program Files\nodejs\node_modules\npm>npm install node-gyp --save
i want to learn node js and my boss send me this project but its show error. how to solve this type of problem when i enter npm install this command is show below error...i already installed visual studio 2015
gyp ERR! stack operable program or batch file.
gyp ERR! stack
gyp ERR! stack Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:134:25
gyp ERR! stack at ChildProcess.exithandler (child_process.js:213:5)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
gyp ERR! System Windows_NT 6.1.7601
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 D:\Addi\HeavyMetalServer\node_modules\iltorb
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
Your npm install command fails during installing node-gyp module. node-gyp module gives a lot of problems when installing on windows. You can run this command to install its dependencies first - npm install --global --production windows-build-tools . This command is given on their github page.
For windows users:
Try running the npm install command from Powershell with administrative rights
This is one of the many workarounds
Since I installed node 5.0.0, I start getting errors while installing most of npm packages.
it never happened before when I had node 4.x.
after
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python27\python.exe", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:116:14)
gyp ERR! stack at c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:71:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.10240
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\Murhaf\AppData\Roaming\npm\node_modules\ember-cli\node_modules\bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10240
basically there's 2 main errors.
The first is asking for python.
The second is asking for .Net SDK 2.0.
after getting python 2.7.10 installed the first error disappeared. but I couldn't pass the MSbuild.exe error even after installing .Net SDK.
Is this happening with everyone?
Do I have to install Visual Studio to get node.js and NPM to work?
I prefer not to. Any alternative way?
I tried a clean installation, restarted my PC and installed it again, same errors.
Update
Now I installed both Python and VS2015, the previous errors are gone but I have this error
c:\Users\Murhaf\Desktop\sage\node_modules\bufferutil\build\bufferutil.vcxproj(20,3): error MSB4019: The imported projec
t "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\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: `msbuild` 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:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
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\Murhaf\Desktop\sage\node_modules\bufferutil
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:bufferutil bufferutil#1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil Exit status 1
you need Visual Studio and Python to install modules with binary components on windows, which probably means the module you are trying to install has binary components, so try to install it after Visual studio and Python.
npm install --msvs_version=2013 should work.
I am having problems with VS2015, too.