Better-sqlite3: Can this module be built with MSBuild v150

Created on 30 Jan 2019  路  8Comments  路  Source: JoshuaWise/better-sqlite3

I'm not very sure about this, but last time I tried to build this module, it failed because I am using VS2017 (v150) build tools. Is it a real issue or its some other error I encountered?

question

Most helpful comment

You can use the v140 build tools by running this command:

npm i -g --prodution --vs2015 --add-python-to-path windows-build-tools node-gyp

If you're wondering how to make the installation work with the v150 tools, that's a question outside of my expertise. Hopefully someone with more knowledge of Windows can chime in.

I simply rely on node-gyp to work as advertised. To my knowledge, there's nothing about better-sqlite3 that's specific to unix or linux systems.

All 8 comments

Old versions of node-gyp don't support VS2017, so many users have successfully installed this package by using VS2015 (learn how here).

However, updating npm (and thus, consequently updating its bundled node-gyp), might solve this issue (evidence here). People have had success just by running npm install -g npm.

I don't have a Windows machine to test better-sqlite3 on. I rely on simply writing portable code, which seems to have been successful for most Windows users.

I see. I'll check my npm version and see if the issue still exists.

Tried, and got this error:
```
位 npm i better-sqlite3

[email protected] install C:\Users\User\Desktop\node_modulesbetter-sqlite3
node-gyp rebuild

C:\Users\User\Desktop\node_modulesbetter-sqlite3>if not defined npm_config_node_gyp (node "C:\Users\User\AppData\Roamingnpm\node_modulesnpm\node_modulesnpm-lifecyclenode-gyp-bin\....\node_modulesnode-gypbinnode-gyp.js" rebuild ) else (node "C:\Users\User\AppData\Roamingnpm\node_modulesnpm\node_modulesnode-gypbinnode-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot
be found. To build using the v140 build tools, please install v140 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solut ion, and then selecting "Retarget solution". [C:\Users\User\Desktop\node_modulesbetter-sqlite3\build\deps\locate_sqlite3.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\User\AppData\Roamingnpm\node_modulesnpm\node_modulesnode-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\User\Desktop\node_modulesbetter-sqlite3
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\User\Desktop\package.json'
npm WARN Desktop No description
npm WARN Desktop No repository field.
npm WARN Desktop No README data
npm WARN Desktop No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roamingnpm-cache_logs\2019-02-03T03_42_12_100Z-debug.log```
any ideas?

If you do have the v140 toolset installed with VS2015, I wouldn't know why node-gyp is unable to find them (according to that error message). That's outside the realm of better-sqlite3, and inside the realm of node-gyp itself.

No; thats the message when I used v150 (vs2017) build tools. Since windows-build-tools now defaults to vs2017, I wonder if there is a way to prevent these kind of errors to happen (hopefully can compile on both versions.

You can use the v140 build tools by running this command:

npm i -g --prodution --vs2015 --add-python-to-path windows-build-tools node-gyp

If you're wondering how to make the installation work with the v150 tools, that's a question outside of my expertise. Hopefully someone with more knowledge of Windows can chime in.

I simply rely on node-gyp to work as advertised. To my knowledge, there's nothing about better-sqlite3 that's specific to unix or linux systems.

I see. I'll have to install both vs versions to make sure every module can be compiled then. Thanks!

No problem 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pke picture pke  路  3Comments

instagendleg picture instagendleg  路  4Comments

jonataswalker picture jonataswalker  路  5Comments

DrDonkeyPunch picture DrDonkeyPunch  路  5Comments

mann-david picture mann-david  路  5Comments