Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win7 - Support #8

Closed
Steviey opened this issue Oct 9, 2016 · 24 comments
Closed

Win7 - Support #8

Steviey opened this issue Oct 9, 2016 · 24 comments

Comments

@Steviey
Copy link

Steviey commented Oct 9, 2016

Win 7:

Command: npm install --save better-sqlite3

...fails with the following ouput...

674 verbose cwd C:\b\hello-electron-with-pouchdb
675 error Windows_NT 6.1.7601
676 error argv "C:\Program Files\nodejs\node.exe" "C:\Users\Stevie\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save" "better-sqlite3"
677 error node v4.6.0
678 error npm v3.10.8
679 error code ELIFECYCLE
680 error better-sqlite3@1.3.5 install: node install
680 error Exit status 1
681 error Failed at the better-sqlite3@1.3.5 install script 'node install'.
681 error Make sure you have the latest version of node.js and npm installed.
681 error If you do, this is most likely a problem with the better-sqlite3 package,
681 error not with npm itself.
681 error Tell the author that this fails on your system:
681 error node install
681 error You can get information on how to open an issue for this project with:
681 error npm bugs better-sqlite3
681 error Or if that isn't available, you can get their info via:
681 error npm owner ls better-sqlite3
681 error There is likely additional logging output above.
682 verbose exit [ 1, true ]

Do I miss some version-requirements?

@JoshuaWise
Copy link
Member

This log doesn't include any useful information. Are you sure this is the entire log? You may have discarded a few lines.

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

maximum is 65536 characters...the log is to long. Is there a way to attache a text file here?

@JoshuaWise
Copy link
Member

Maybe, but you could just post it across several comments.

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

Here is the complete npm-log:
It's a file based/Nodejs Electron project
https://drive.google.com/open?id=0B-6DFPnens9ceS1kSkk2MWhoa2M

@JoshuaWise
Copy link
Member

Hm, I still don't see any useful information in there. Whatever is causing the error isn't logging where the error occurs.

I have two guesses:

  • Make sure Python 2.7 is in your PATH environment variable as "python"
  • Make sure you've installed the Windows Build Tools from a command prompt with administrative privileges

Windows Build Tools:

npm install --global --production windows-build-tools

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

I have Python 2.7 + PATH + Build Tools + C++ Build Tools + PATH on board.
Here is additional data direct from the screen, which is obviously not always included in the log.

C:\b\hello-electron-with-pouchdb>npm install better-sqlite3 --save

better-sqlite3@1.3.5 install C:\b\hello-electron-with-pouchdb\node_modules\better-sqlite3
node install

events.js:141
throw er; // Unhandled 'error' event
^

Error: spawn node-gyp ENOENT
at exports._errnoException (util.js:907:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:974:3
npm WARN enoent ENOENT: no such file or directory, open 'C:\b\hello-electron-with-pouchdb\node_modules\New folder\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\b\hello-electron-with-pouchdb\node_modules\sqlite3\package.json'
npm WARN hello-electron-with-pouchdb@1.0.0 No repository field.
npm WARN hello-electron-with-pouchdb@1.0.0 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Stevie\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "better-sqlite3" "-
-save"
npm ERR! node v4.6.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! better-sqlite3@1.3.5 install: node install
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@1.3.5 install script 'node install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the better-sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs better-sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls better-sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\b\hello-electron-with-pouchdb\npm-debug.log

C:\b\hello-electron-with-pouchdb>

@JoshuaWise
Copy link
Member

Ah! That's the useful information I was looking for.

spawn node-gyp ENOENT usually means node-gyp can't find your Python installation.

In the command prompt (cmd.exe), when you type python does Python 2.7 open?

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

Yes it does...

C:\b\hello-electron-with-pouchdb>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

It opens a Python shell

@JoshuaWise
Copy link
Member

It looks like your Python install is 32-bit. Is your Node.js install also 32-bit? If they are different, it won't work.

@JoshuaWise
Copy link
Member

You're experiencing this issue: nodejs/node-gyp#277

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

Interesting... will change Python version, reboot and retry.

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

Changed Python to 64 bit...got same output....

C:\b\hello-electron-with-pouchdb>npm install better-sqlite3 --save

better-sqlite3@1.3.5 install C:\b\hello-electron-with-pouchdb\node_modules\better-sqlite3
node install

events.js:141
throw er; // Unhandled 'error' event
^

Error: spawn node-gyp ENOENT
at exports._errnoException (util.js:907:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:974:3
npm WARN enoent ENOENT: no such file or directory, open 'C:\b\hello-electron-with-pouchdb\node_modules\New folder\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\b\hello-electron-with-pouchdb\node_modules\sqlite3\package.json'
npm WARN hello-electron-with-pouchdb@1.0.0 No repository field.
npm WARN hello-electron-with-pouchdb@1.0.0 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Stevie\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "better-sqlite3" "-
-save"
npm ERR! node v4.6.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! better-sqlite3@1.3.5 install: node install
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@1.3.5 install script 'node install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the better-sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs better-sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls better-sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\b\hello-electron-with-pouchdb\npm-debug.log

C:\b\hello-electron-with-pouchdb>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

...A little bit strange I'm on Intel on Win7/64 bit

@JoshuaWise
Copy link
Member

And you're sure your Node.js version is 64-bit too?

@Steviey
Copy link
Author

Steviey commented Oct 9, 2016

Got it with Task-Explorer Python = 64bit, NodeJs=64bit
The win32 is somehow missleading. Its' meant to be the API, see http://stackoverflow.com/questions/24956691/how-to-determine-whether-i-have-64bit-or-32-bit-node-executable-installed

However my Python was initially 32 Bit which I changed now.
Meanwhile I got Sqlite3 working with some hints, possibly thanks to your additional Python-advice.
After one week of investigations and tweakings. This was my longest hint hunting in 20 years of developments- related to implement a simple, local, persistent database.
Would be nice to test out better-sqlite3 too. I'm relaxing now.

@JoshuaWise
Copy link
Member

Node.js binary add-ons are historically a pain in the butt with Windows. Let me know if you get better-sqlite3 working, or if any new information regarding the issue surfaces.

@marcocbarbieri
Copy link

I'm getting a similar error on win10:

better-sqlite3@1.2.1 install D:\dev\tools\N1-master\N1-master\node_modules\better-sqlite3
if [ "$CI" = "true" ]; then node-gyp rebuild --debug; else node-gyp rebuild; fi;

"$CI" foi inesperado neste momento.
npm WARN nylas@0.4.56 No license field.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files\nodejs\node.exe" "D:\Users\myuser\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save" "better-sqlite3"
npm ERR! node v4.6.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! better-sqlite3@1.2.1 install: if [ "$CI" = "true" ]; then node-gyp rebuild --debug; else node-gyp rebuild; fi;
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the better-sqlite3@1.2.1 install script 'if [ "$CI" = "true" ]; then node-gyp rebuild --debug; else node-gyp rebuild; fi;'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the better-sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! if [ "$CI" = "true" ]; then node-gyp rebuild --debug; else node-gyp rebuild; fi;
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs better-sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls better-sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\dev\tools\N1-master\N1-master\node_modules\npm-debug.log

@JoshuaWise
Copy link
Member

@marcocbarbieri
You're experiencing a different issue, which has been resolved in issue #5

@JoshuaWise
Copy link
Member

JoshuaWise commented Oct 11, 2016

I'm unable to reproduce this issue on my windows machine.

What I did to make it work:

  • npm install --global node-gyp from cmd.exe with Administrator Privileges
  • npm install --global --production windows-build-tools from cmd.exe with Administrator Privileges
  • Install Python 2.7 from https://www.python.org/downloads/
    • During installation make sure to check the box for "Add python.exe to Path"
  • npm config delete python from cmd.exe
  • npm install --save better-sqlite3@1.3.5 from cmd.exe

@bengotow
Copy link
Contributor

Hey folks - I'm also looking into this today because it's blocking a beta release of N1 (saw above one of the errors is from N1!) I think this is the more verbose output from node-gyp. We do all the builds on AppVeyor (https://ci.appveyor.com/project/nylas/n1) and it looks like it may not be installing CL.exe:

gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@6.7.0 | win32 | x64
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\IEUser\\AppData\\Roaming\\nvm\\v6.7.0\\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   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\IEUser\\Documents\\better-sqlite3\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\IEUser\\AppData\\Roaming\\nvm\\v6.7.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\IEUser\\.node-gyp\\6.7.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\\IEUser\\.node-gyp\\6.7.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\IEUser\\AppData\\Roaming\\nvm\\v6.7.0\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\IEUser\\Documents\\better-sqlite3',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\IEUser\\Documents\\better-sqlite3\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn msbuild
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.
  unpack_sqlite_dep
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\IEUser\Docume
nts\better-sqlite3\build\deps\sqlite3.vcxproj]


gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\IEUser\AppData\Roaming\nvm\v6.7.0\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
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.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\IEUser\\AppData\\Roaming\\nvm\\v6.7.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\IEUser\Documents\better-sqlite3
gyp ERR! node -v v6.7.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

@bengotow
Copy link
Contributor

bengotow commented Oct 11, 2016

Looks like we can resolve that issue by building specifically with Visual Studio 2013 or lower by passing -msvs_version=2013 to node-gyp on AppVeyor. (Per this SO question http://stackoverflow.com/questions/31953769/visual-studio-doesnt-have-cl-exe, it looks like AppVeyor's copy of VS2015 may not include C++ support.) Now we're getting a more interesting compilation error:

c:\users\ieuser\documents\better-sqlite3\src\binder\get-error.cc(11): error C3861: 'snprintf': identifier not found (..
\src\binder\binder.cc) [C:\Users\IEUser\Documents\better-sqlite3\build\better_sqlite3.vcxproj]

It looks like snprintf wasn't added until Visual Studio 2014 (http://stackoverflow.com/questions/9052224/error4error-c3861-snprintf-identifier-not-found)?

@JoshuaWise
Copy link
Member

JoshuaWise commented Oct 11, 2016

Thanks for all the work you've done to help solve this issue! I suppose there are alternatives to snprintf. It's not a very integral part of the library.

UPDATE: Actually, it turns out that sqlite3 provides their own version of snprintf that we can use instead.

@JoshuaWise
Copy link
Member

Okay, I've just released a patch, version 1.3.6, which is no longer dependent on snprintf.

@bengotow
Copy link
Contributor

Oh cool—didn't actually look to see if it could be worked around! Will upgrade and see if that fixes it.

@bengotow
Copy link
Contributor

bengotow commented Oct 12, 2016

I've confirmed that removing snprintf allowed us to build on VS2013! I tried moving us to VS2015, but a bunch of other native node modules didn't build. Thanks for increasing backwards compatibility 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants