Closed photonstorm closed 6 years ago
Thanks for documenting your process. It looks like all of this is covered in the troubleshooting guide, except for:
Install node-gyp locally, it doesn't seem to pick-up a globally installed version
I'll have to investigate why that's happening.
I had a similar problem, and did everything in the troubleshooting guide but the install was still failing with `Error: Cannot find module '
I had the same issue and here is my process for fixing it: https://github.com/JoshuaWise/better-sqlite3/issues/79#issuecomment-359542121
After a lot of trial and error I finally managed to get this package installed on Windows 10. I'm logging some of my journey here to aid anyone else searching for similar issues in the future.
My set-up: Windows 10, Python 2.7 (32-bit) and node v6.4.0 (32-bit). I had Python 3 installed as well so modified my environment vars so that issuing the command
python
from the command line took me into the 2.7 release. If it doesn't do that, node-gyp won't work.When trying to install better-sqlite3 it errored as node-gyp tries to compile the
win_delay_load_hook.cc
module:I checked and it was using the 2013 version of the msvs tools, so I set
msvs_version
to 2015.This got me a little bit further.
Now I got the
Cl.exe
not found error. The easiest way to fix this was to actually run Visual Studio 2015 and try to create a C++ project (not C#!). C++ build support isn't installed by default, so doing this forced VS to download everything it needed (all 3GB of it).Trying to install better-sqlite3 now gives a warning in
win_delay_load_hook.cc
:..\src\integer.cpp(370): warning C4804: '-': unsafe use of type 'bool' in operation
(plus some warnings about uint64_t conversion) - but it did get past that and created the library, generated the code and then errored on lzz-gyp complaining about 'Make' not being installed (which clearly it isn't on Windows).I had added
LZZ_COMPAT=1
to my environment variables earlier on while trying to get it running - but this actually caused the above error. So as per the advice in the lzz-gyp repo I removed those vars and indeed it now gets past that section.Now it dies on
node-gyp rebuild
saying it "Cannot find module node-gyp\bin\node-gyp.js", which is weird as it's globally installed on my system! So, I rannpm install node-gyp
locally in my project folder and that completed, after which I finally got to install better-sqlite3 and it got to the very end with no red text errors. There were lots of yellow build warnings, but I'll take those happily.To summarize for Windows 10 users:
1) Ensure you've got Python 2.7, not 3, and that you can run it from the command prompt 2) Ensure Python and Node are both 32-bit, or both 64-bit, but not a mixture of the two 3) Don't add
LZZ_COMPAT=1
to your environment vars 4) Installnode-gyp
locally, it doesn't seem to pick-up a globally installed version 5) Install Visual Studio 2015 with C++ support (or if already installed, try and create a C++ project), this will fix dependency issues with Cl.exe, paths, etc - this is the only thing that worked for me, installing the windows-build-tools package didn't resolve pathing issues. 6) Usenpm config set msvs_version 2015
once the above is all done.On a plain vanilla install of Windows you may not need to do any of this, but as I had multiple versions of Visual Studio already installed, multiple versions of Python, etc, it was a real hornets nest to unpick and configure.
Good luck!