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 and npm -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, then npm 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)

Most upvoted comments

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 piece

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.

WORKED FOR ME AFTER TRYING EVERYTHING! Just had to delete the package-lock.json file

Came across exact same issue when trying to install fibers package globally.

npm -g install fibers
0 verbose cli [
0 verbose cli   'C:\\ProgramData\\scoop\\apps\\nodejs-lts\\current\\node.exe',
0 verbose cli   'C:\\ProgramData\\scoop\\persist\\nodejs-lts\\bin\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   '-g',
0 verbose cli   'i',
0 verbose cli   'fibers'
0 verbose cli ]
1 info using npm@8.1.4
2 info using node@v16.13.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\npmrc Completed in 4ms
6 timing config:load:builtin Completed in 4ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:C:\Users\fery\.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:\ProgramData\scoop\persist\nodejs-lts\bin\etc\npmrc Completed in 1ms
13 timing config:load:global Completed in 1ms
14 timing config:load:validate Completed in 0ms
15 timing config:load:credentials Completed in 1ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 13ms
18 timing npm:load:configload Completed in 13ms
19 timing npm:load:setTitle Completed in 1ms
20 timing npm:load:setupLog Completed in 1ms
21 timing config:load:flatten Completed in 4ms
22 timing npm:load:cleanupLog Completed in 3ms
23 timing npm:load:configScope Completed in 0ms
24 timing npm:load:projectScope Completed in 0ms
25 timing npm:load Completed in 24ms
26 timing arborist:ctor Completed in 1ms
27 timing idealTree:init Completed in 7ms
28 timing idealTree:userRequests Completed in 3ms
29 silly idealTree buildDeps
30 silly fetch manifest fibers@*
31 http fetch GET 200 https://registry.npmjs.org/fibers 255ms (cache revalidated)
32 silly placeDep ROOT fibers@5.0.0 OK for:  want: *
33 silly fetch manifest detect-libc@^1.0.3
34 http fetch GET 200 https://registry.npmjs.org/detect-libc 59ms (cache revalidated)
35 timing idealTree:#root Completed in 333ms
36 silly placeDep node_modules/fibers detect-libc@1.0.3 OK for: fibers@5.0.0 want: ^1.0.3
37 timing idealTree:node_modules/fibers Completed in 4ms
38 timing idealTree:node_modules/fibers/node_modules/detect-libc Completed in 0ms
39 timing idealTree:buildDeps Completed in 340ms
40 timing idealTree:fixDepFlags Completed in 1ms
41 timing idealTree Completed in 352ms
42 timing reify:loadTrees Completed in 356ms
43 timing reify:diffTrees Completed in 1ms
44 silly reify moves {}
45 timing reify:retireShallow Completed in 0ms
46 timing reify:createSparse Completed in 3ms
47 timing reify:loadBundles Completed in 0ms
48 silly audit bulk request { fibers: [ '5.0.0' ], 'detect-libc': [ '1.0.3' ] }
49 timing reifyNode:node_modules/fibers/node_modules/detect-libc Completed in 61ms
50 timing reifyNode:node_modules/fibers Completed in 140ms
51 timing reify:unpack Completed in 140ms
52 timing reify:unretire Completed in 0ms
53 timing build:queue Completed in 1ms
54 timing build:link:node_modules/fibers/node_modules/detect-libc Completed in 6ms
55 timing build:link Completed in 7ms
56 info run fibers@5.0.0 install node_modules/fibers node build.js || nodejs build.js
57 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 964ms
58 timing auditReport:getReport Completed in 965ms
59 silly audit report {}
60 timing auditReport:init Completed in 0ms
61 timing reify:audit Completed in 966ms
62 info run fibers@5.0.0 install { code: 1, signal: null }
63 timing reify:rollback:createSparse Completed in 20ms
64 timing reify:rollback:retireShallow Completed in 0ms
65 timing command:i Completed in 2048ms
66 verbose stack Error: command failed
66 verbose stack     at ChildProcess.<anonymous> (C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
66 verbose stack     at ChildProcess.emit (node:events:390:28)
66 verbose stack     at maybeClose (node:internal/child_process:1064:16)
66 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
67 verbose pkgid fibers@5.0.0
68 verbose cwd D:\Workspace
69 verbose Windows_NT 10.0.19043
70 verbose argv "C:\\ProgramData\\scoop\\apps\\nodejs-lts\\current\\node.exe" "C:\\ProgramData\\scoop\\persist\\nodejs-lts\\bin\\node_modules\\npm\\bin\\npm-cli.js" "-g" "i" "fibers"
71 verbose node v16.13.0
72 verbose npm  v8.1.4
73 error code 1
74 error path C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\fibers
75 error command failed
76 error command C:\WINDOWS\system32\cmd.exe /d /s /c node build.js || nodejs build.js
77 error gyp info it worked if it ends with ok
77 error gyp info using node-gyp@8.4.0
77 error gyp info using node@16.13.0 | win32 | x64
77 error gyp info find Python using Python version 3.10.0 found at "C:\ProgramData\scoop\apps\python\current\python.exe"
77 error gyp ERR! find VS
77 error gyp ERR! find VS msvs_version was set from command line or npm config
77 error gyp ERR! find VS - looking for Visual Studio version 2019
77 error gyp ERR! find VS running in VS Command Prompt, installation path is:
77 error gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio"
77 error gyp ERR! find VS - will only use this version
77 error gyp ERR! find VS checking VS2019 (16.11.31911.196) found at:
77 error gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
77 error gyp ERR! find VS - found "Visual Studio C++ core features"
77 error gyp ERR! find VS - found VC++ toolset: v142
77 error gyp ERR! find VS - found Windows SDK: 10.0.19041.0
77 error gyp ERR! find VS - does not match this Visual Studio Command Prompt
77 error gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
77 error gyp ERR! find VS looking for Visual Studio 2015
77 error gyp ERR! find VS - not found
77 error gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
77 error gyp ERR! find VS msvs_version does not match this VS Command Prompt or the
77 error gyp ERR! find VS installation cannot be used.
77 error gyp ERR! find VS
77 error gyp ERR! find VS **************************************************************
77 error gyp ERR! find VS You need to install the latest version of Visual Studio
77 error gyp ERR! find VS including the "Desktop development with C++" workload.
77 error gyp ERR! find VS For more information consult the documentation at:
77 error gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
77 error gyp ERR! find VS **************************************************************
77 error gyp ERR! find VS
77 error gyp ERR! configure error
77 error gyp ERR! stack Error: Could not find any Visual Studio installation to use
77 error gyp ERR! stack     at VisualStudioFinder.fail (C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
77 error gyp ERR! stack     at C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
77 error gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
77 error gyp ERR! stack     at C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
77 error gyp ERR! stack     at C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
77 error gyp ERR! stack     at C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
77 error gyp ERR! stack     at C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
77 error gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
77 error gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
77 error gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
77 error gyp ERR! System Windows_NT 10.0.19043
77 error gyp ERR! command "C:\\ProgramData\\scoop\\apps\\nodejs-lts\\current\\node.exe" "C:\\ProgramData\\scoop\\persist\\nodejs-lts\\bin\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
77 error gyp ERR! cwd C:\ProgramData\scoop\persist\nodejs-lts\bin\node_modules\fibers
77 error gyp ERR! node -v v16.13.0
77 error gyp ERR! node-gyp -v v8.4.0
77 error gyp ERR! not ok
77 error node-gyp exited with code: 1
77 error Please make sure you are using a supported platform and node version. If you
77 error would like to compile fibers on this machine please make sure you have setup your
77 error build environment--
77 error Windows + OS X instructions here: https://github.com/nodejs/node-gyp
77 error Ubuntu users please run: `sudo apt-get install g++ build-essential`
77 error RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'`
77 error Alpine users please run: `sudo apk add python make g++`
77 error 'nodejs' is not recognized as an internal or external command,
77 error operable program or batch file.
78 verbose exit 1

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).