`npm install` cannot find Visual Studio 2022 Community
See original GitHub issue- Node Version: v18.9.0, npm 8.0.0, node-gyp v9.0.0
- Platform: Windows 10
- Compiler: msbuild/2022
- Module: net-ping and icmp
Verbose output (from npm or node-gyp):
npm verb cli [
npm verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Users\\12034\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'i',
npm verb cli 'icmp',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@8.0.0
npm info using node@v18.9.0
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 2ms
npm timing config:load:file:C:\Users\12034\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 8ms
npm timing config:load:builtin Completed in 8ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:E:\Github\DasherChristmas\dasher-controllers\.npmrc Completed in 0ms
npm timing config:load:project Completed in 1ms
npm timing config:load:file:C:\Users\12034\.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:C:\Users\12034\AppData\Roaming\npm\etc\npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 17ms
npm timing npm:load:configload Completed in 17ms
npm timing npm:load:setTitle Completed in 0ms
npm timing npm:load:setupLog Completed in 1ms
npm timing config:load:flatten Completed in 3ms
npm timing npm:load:cleanupLog Completed in 3ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load:projectScope Completed in 1ms
npm timing npm:load Completed in 42ms
npm timing arborist:ctor Completed in 1ms
npm timing arborist:ctor Completed in 0ms
npm timing arborist:ctor Completed in 0ms
npm timing arborist:ctor Completed in 0ms
npm timing idealTree:init Completed in 81ms
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm http fetch GET 200 https://registry.npmjs.org/fetch-blob 114ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@types%2fws 124ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/data-uri-to-buffer 132ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/@types%2fnode 152ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/node-domexception 68ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/formdata-polyfill 82ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/typescript 65ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/node-fetch 232ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/web-streams-polyfill 227ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/ws 225ms (cache hit)
npm timing idealTree:inflate Completed in 464ms
npm timing idealTree:userRequests Completed in 2ms
npm http fetch GET 200 https://registry.npmjs.org/icmp 6ms (cache hit)
npm http fetch GET 200 https://registry.npmjs.org/raw-socket 12ms (cache hit)
npm timing idealTree:#root Completed in 35ms
npm http fetch GET 200 https://registry.npmjs.org/nan 12ms (cache hit)
npm timing idealTree:node_modules/icmp Completed in 24ms
npm timing idealTree:node_modules/raw-socket Completed in 2ms
npm timing idealTree:node_modules/nan Completed in 0ms
npm timing idealTree:buildDeps Completed in 74ms
npm timing idealTree:fixDepFlags Completed in 0ms
npm timing idealTree Completed in 633ms
npm timing reify:loadTrees Completed in 634ms
npm timing reify:diffTrees Completed in 11ms
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 66ms
npm timing reify:loadBundles Completed in 0ms
npm timing reifyNode:node_modules/icmp Completed in 249ms
npm timing reifyNode:node_modules/raw-socket Completed in 371ms
npm timing reifyNode:node_modules/nan Completed in 506ms
npm timing reify:unpack Completed in 507ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 0ms
npm info run raw-socket@1.7.0 install node_modules/raw-socket node-gyp rebuild
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 1154ms
npm timing auditReport:getReport Completed in 1157ms
npm timing auditReport:init Completed in 0ms
npm timing reify:audit Completed in 1159ms
npm info run raw-socket@1.7.0 install { code: 1, signal: null }
npm timing reify:rollback:createSparse Completed in 103ms
npm timing reify:rollback:retireShallow Completed in 0ms
npm timing command:install Completed in 2577ms
npm verb stack Error: command failed
npm verb stack at ChildProcess.<anonymous> (C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
npm verb stack at ChildProcess.emit (node:events:513:28)
npm verb stack at maybeClose (node:internal/child_process:1091:16)
npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid raw-socket@1.7.0
npm verb cwd E:\Github\DasherChristmas\dasher-controllers
npm verb Windows_NT 10.0.19043
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\12034\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i" "icmp" "--verbose"
npm verb node v18.9.0
npm verb npm v8.0.0
npm ERR! code 1
npm ERR! path E:\Github\DasherChristmas\dasher-controllers\node_modules\raw-socket
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli 'C:\\Users\\12034\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@8.2.0
npm ERR! gyp info using node@18.9.0 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
npm ERR! gyp verb find Python checking if "python" can be used
npm ERR! gyp verb find Python - executing "python" to get executable path
npm ERR! gyp verb find Python - executable path is "C:\Python310\python.exe"
npm ERR! gyp verb find Python - executing "C:\Python310\python.exe" to get version
npm ERR! gyp verb find Python - version is "3.10.7"
npm ERR! gyp info find Python using Python version 3.10.7 found at "C:\Python310\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.9.0
npm ERR! gyp verb command install [ '18.9.0' ]
npm ERR! gyp verb install input version string "18.9.0"
npm ERR! gyp verb install installing version: 18.9.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 18.9.0
npm ERR! gyp verb build dir attempting to create "build" dir: E:\Github\DasherChristmas\dasher-controllers\node_modules\raw-socket\build
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb find VS msvs_version was set from command line or npm config
npm ERR! gyp verb find VS - looking for Visual Studio version 2022
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp verb find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp verb find VS looking for Visual Studio 2015
npm ERR! gyp verb find VS - not found
npm ERR! gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version was set from command line or npm config
npm ERR! gyp ERR! find VS - looking for Visual Studio version 2022
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS unknown version "undefined" found at "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS valid versions for msvs_version:
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack at C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack at C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack at C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack at C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\12034\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:420:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\12034\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\Github\DasherChristmas\dasher-controllers\node_modules\raw-socket
npm ERR! gyp ERR! node -v v18.9.0
npm ERR! gyp ERR! node-gyp -v v8.2.0
npm ERR! gyp ERR! not ok
npm verb exit 1
npm timing npm Completed in 3153ms
npm verb unfinished npm timer reify 1663269833866
npm verb unfinished npm timer reify:build 1663269835122
npm verb unfinished npm timer build 1663269835122
npm verb unfinished npm timer build:deps 1663269835122
npm verb unfinished npm timer build:run:install 1663269835124
npm verb unfinished npm timer build:run:install:node_modules/raw-socket 1663269835124
npm verb code 1
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\12034\AppData\Local\npm-cache\_logs\2022-09-15T19_23_56_515Z-debug.log
A side note: I am aware that the logs say node-gyp v8.2.0. however, running node-gyp -v
returns v9.0.0
I have spent about four hours attempting to solve this issue, bouncing from stackoverflow to #2552 and back, and nothing seems to work. I have repeatedly followed the instructions from master
/docs/Updating-npm-bundled-node-gyp.md as well as setting the VCINSTALLDIR
env variable to the same value as it appears in the Visual Studio Developer Console and installing windows build tools, which also breaks (if you want I can give my logs for that, but it is not directly related). I have set msvs_version
to 2022 in the npm config, set msbuild_path
to C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
, and ensured that my PowerShell terminal is in full language mode. I have installed the Desktop Development With C++ workload as well.
I am new-er to using native modules, so please excuse any lack of knowledge I have or information I have provided, though I tried to make sure I had everything.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (1 by maintainers)
I managed to fix this. It was definitely my older version of
node-gyp
, and I rannpm i -g node-gyp@9.1.0 --force
just on a whim to see if it changed anything and everything now installs correctly. Sorry to bother you.Better error log:
Verbose output (from npm or node-gyp):
I manually went in through windows and changed the environment variable
VCINSTALLDIR
since the terminal did not seem to be doing it. After I rebooted the terminal, this is what came out.