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

Can this module be built with MSBuild v150 #224

Closed
takase1121 opened this issue Jan 30, 2019 · 8 comments
Closed

Can this module be built with MSBuild v150 #224

takase1121 opened this issue Jan 30, 2019 · 8 comments
Labels

Comments

@takase1121
Copy link

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?

@JoshuaWise
Copy link
Member

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.

@takase1121
Copy link
Author

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

@takase1121
Copy link
Author

Tried, and got this error:

λ npm i better-sqlite3

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


C:\Users\User\Desktop\node_modules\better-sqlite3>if not defined npm_config_node_gyp (node "C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-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_modules\better-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\Roaming\npm\node_modules\npm\node_modules\node-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_modules\better-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\Roaming\npm-cache\_logs\2019-02-03T03_42_12_100Z-debug.log```
 any ideas?

@JoshuaWise
Copy link
Member

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.

@takase1121
Copy link
Author

takase1121 commented Feb 4, 2019

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.

@JoshuaWise
Copy link
Member

JoshuaWise commented Feb 4, 2019

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.

@takase1121
Copy link
Author

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

@JoshuaWise
Copy link
Member

No problem 👍

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

No branches or pull requests

2 participants