node-gyp: [windows] node-gyp fails to find Visual Studio Build Tools 2017

Hi, node-gyp fails to find Visual Studio Build Tools 2017

msvs_version does not match this version could not find a version of Visual Studio 2017 or newer to use

  • node-gyp version: node-gyp v5.0.7
  • Node Version: node v13.1.0 npm 6.12.1
  • Platform: Windows 10
  • Compiler: 15.9.21.664 (Microsoft ® Build Engine version 15.9.21+g9802d43bc3 for .NET Framework)
  • Module: ffs
Verbose output (from npm or node-gyp):
V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor>node-gyp rebuild --verbose
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'X:\\Program Files\\Node\\node.exe',
gyp verb cli   'C:\\Users\\OSO\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose'
gyp verb cli ]
gyp info using node-gyp@5.0.7
gyp info using node@13.1.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - executable path is "X:\Program Files\Python\Python3\python.exe"
gyp verb find Python - executing "X:\Program Files\Python\Python3\python.exe" to get version
gyp verb find Python - version is "3.8.0"
gyp info find Python using Python version 3.8.0 found at "X:\Program Files\Python\Python3\python.exe"
gyp verb get node dir no --target version specified, falling back to host node version: 13.1.0
gyp verb command install [ '13.1.0' ]
gyp verb install input version string "13.1.0"
gyp verb install installing version: 13.1.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 13.1.0
gyp verb build dir attempting to create "build" dir: V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\build
gyp verb build dir "build" dir needed to be created? V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\build
gyp verb find VS msvs_version not set from command line or npm config
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2017 (15.9.28307.960) found at:
gyp verb find VS "X:\Program Files\Visual Studio\Build Tools 2017"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v141
gyp verb find VS - found Windows SDK: 10.0.17763.0
gyp info find VS using VS2017 (15.9.28307.960) found at:
gyp info find VS "X:\Program Files\Visual Studio\Build Tools 2017"
gyp info find VS run with --verbose for detailed information
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\build\config.gypi
gyp verb config.gypi checking for gypi file: V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\config.gypi
gyp verb common.gypi checking for gypi file: V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn X:\Program Files\Python\Python3\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Users\\OSO\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'V:\\Programming\\JavaScript\\Programming\\Projects\\_node\\node-tablet-monitor\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\OSO\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\OSO\\AppData\\Local\\node-gyp\\Cache\\13.1.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\OSO\\AppData\\Local\\node-gyp\\Cache\\13.1.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\OSO\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\OSO\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\13.1.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=V:\\Programming\\JavaScript\\Programming\\Projects\\_node\\node-tablet-monitor',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'V:\\Programming\\JavaScript\\Programming\\Projects\\_node\\node-tablet-monitor\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: binding.gyp not found (cwd: V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\OSO\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "X:\\Program Files\\Node\\node.exe" "C:\\Users\\OSO\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose"
gyp ERR! cwd V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor
gyp ERR! node -v v13.1.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor>npm install -g node-gyp
C:\Users\OSO\AppData\Roaming\npm\node-gyp -> C:\Users\OSO\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js
+ node-gyp@5.0.7
updated 1 package in 2.258s

V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor>npm install ffi

> ref@1.3.5 install V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\node_modules\ref
> node-gyp rebuild


V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\node_modules\ref>if not defined npm_config_node_gyp (node "X:\Program Files\Node\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
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 2015
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2017 (15.9.28307.960) found at:
gyp ERR! find VS "X:\Program Files\Visual Studio\Build Tools 2017"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v141
gyp ERR! find VS - found Windows SDK: 10.0.17763.0
gyp ERR! find VS - msvs_version does not match this version
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS - "2017"
gyp ERR! find VS - "X:\Program Files\Visual Studio\Build Tools 2017"
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 (X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack     at X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at X:\Program Files\Node\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:302:5)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at maybeClose (internal/child_process.js:1028:16)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "X:\\Program Files\\Node\\node.exe" "X:\\Program Files\\Node\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd V:\Programming\JavaScript\Programming\Projects\_node\node-tablet-monitor\node_modules\ref
gyp ERR! node -v v13.1.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ref@1.3.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.3.5 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\OSO\AppData\Roaming\npm-cache\_logs\2019-12-22T13_55_29_502Z-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I’m going to close this. It’s been inactive for over a month and it doesn’t really seem to be an issue with (a recent version of) node-gyp.

I have this exact same problem. I am completely stuck. I’ve installed Python manually.

I’ve run npm install --global --production windows-build-tools. I’ve manually installed both the 2019 and 2017 version of Visual Studio Community. Same problem. This is a fresh Windows 10 install, anyone with Windows 10 will probably encounter this problem.

The problem is, I have installed build tools both ways as described in https://github.com/nodejs/node-gyp#on-windows, have Python installed. Added both build tools and Python to Path and npm config variables.

For example: image

Still getting the same error message. 😕

Unfortunately neither of these seems to fix the problem. It’s still reaching out to 2019 to do the compile.
npm config set msvs_version 2017 and yarn config set msvs_version 2017

Hey @nhustak , this line

gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\15.0\Bin\MSBuild.exe

says it will try to execute 32-bit binary.

But the args

gyp info spawn args   '/p:Configuration=Release;Platform=x64'

say that target is x64.

What you need is to make it execute 64-bit binary, which is located under “amd64” subfolder.

Please, read the comment above https://github.com/nodejs/node-gyp/issues/2002#issuecomment-587578162 . It works for me (drawback is that it is a local change)