node-gyp: Could not find any Visual Studio installation to use after trying all the tips I could find online
- Node Version:
node -v
=v12.18.3 andnpm -v
=6.14.8 - Platform:
systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type"
(Windows)
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.18362 N/A Build 18362
System Type: x64-based PC
- Compiler:
msbuild /version & cl
(Windows)
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
15.9.21.664Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27043 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
usage: cl [ option... ] filename... [ /link linkoption... ]
- Module: zeromq
Verbose output (from npm or node-gyp):
me@me-PC0 D:\Desktop\myapp
# node-gyp configure --msvs_version=2017
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.0
gyp info using node@12.18.3 | win32 | x64
gyp info find Python using Python version 3.8.5 found at "C:\Python\Python38\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2017
gyp ERR! find VS running in VS Command Prompt, installation path is:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017"
gyp ERR! find VS - will only use this version
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp ERR! find VS - could not find MSBuild in registry for this version
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS msvs_version does not match this VS Command Prompt or the
gyp ERR! find VS installation cannot be used.
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:20
gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at C:\Users\me\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:310:5)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Apps\\nodejs\\node.exe" "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--msvs_version=2017"
gyp ERR! cwd D:\Desktop\myapp
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v7.1.0
gyp ERR! not ok
Things I’ve tried to no avail
- Reinstall VS 2017 with
Desktop Development Kit for C++
- Reinstall node and npm
- Run the same command in Admin CMD, Admin PowerShell, Admin VC2017 Dev Command Prompt
- Manually set VCINSTALLDIR environment variable to:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\
- Run
npm config set msvs_version 2017 --global
, thennpm config get msvs_version
gives me 2017 - Restart PC every step of the way
I got the same errors as above every step of the way.
Please help!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 21 (2 by maintainers)
Deleting the package-lock.json file resolved the problem for me.
As far as I can tell, no
node_modules/_package_/bin/*
files were being downloaded. I’m not sure why this solved it for me, but there you go.I also had similar issues recently and what helped me to locate the issue was running the npm command with
--loglevel silly
added, this gives you a whole lot more info printed out.My issue was that there were some outdated (non-existing) paths in my LIB environment variable and that made node-gyp fail.
Just follow the instructions at https://github.com/nodejs/node-gyp#on-windows like the error output suggests For me, setting
npm config set msvs_version 2017
was the missing pieceWORKED FOR ME AFTER TRYING EVERYTHING! Just had to delete the
package-lock.json
fileCame across exact same issue when trying to install
fibers
package globally.npm -g install fibers
That
does not match this Visual Studio Command Prompt
line is the only thing make me confused and have no clue whatsoever.Any helps appreciated.
Indeed, this appears to be a cross-platform issue and regenerating
package-lock.json
did the trick.I have two machines, one running Ubuntu the other Windows. The former generated that file and I didn’t encounter any issue. However when I tried installing the modules on the latter, that’s when the issue occurred. Do not install
windows-build-tools
as it is not only heavy but deprecated (and not needed).