MSBuild.exe ENOENT - uses VS2019 instead of VS2017
See original GitHub issue- Node Version: node v11.14.0, npm 6.7.0
- Platform: Microsoft Windows 10 Pro 10.0.17134 x64-based PC
- Module: npm install node-expat // node-gyp rebuild
Verbose output (from npm or node-gyp):
$ npm install node-expat --verbose
npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli 'install',
npm verb cli 'node-expat',
npm verb cli '--verbose' ]
npm info using npm@6.7.0
npm info using node@v11.14.0
npm verb npm-session 7b9b925b92d87a26
npm http fetch GET 304 https://registry.npmjs.org/node-expat 192ms (from cache)
npm timing stage:loadCurrentTree Completed in 237ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 7ms
npm http fetch GET 304 https://registry.npmjs.org/bindings 50ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/nan 103ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/file-uri-to-path 50ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 166ms
npm timing stage:loadIdealTree Completed in 178ms
npm timing stage:generateActionsToTake Completed in 4ms
npm verb correctMkdir C:\Users\emil\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb lock using C:\Users\emil\AppData\Roaming\npm-cache\_locks\staging-52648016cd19f6c3.lock for E:\game\engine\node_modules\.staging
npm timing audit submit Completed in 476ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 476ms
npm timing audit body Completed in 1ms
npm timing action:extract Completed in 759ms
npm timing action:finalize Completed in 6ms
npm timing action:refresh-package-json Completed in 48ms
npm info lifecycle file-uri-to-path@1.0.0~preinstall: file-uri-to-path@1.0.0
npm info lifecycle bindings@1.5.0~preinstall: bindings@1.5.0
npm info lifecycle nan@2.13.2~preinstall: nan@2.13.2
npm info lifecycle node-expat@2.3.17~preinstall: node-expat@2.3.17
npm timing action:preinstall Completed in 2ms
npm info linkStuff file-uri-to-path@1.0.0
npm info linkStuff bindings@1.5.0
npm info linkStuff nan@2.13.2
npm info linkStuff node-expat@2.3.17
npm timing action:build Completed in 3ms
npm info lifecycle file-uri-to-path@1.0.0~install: file-uri-to-path@1.0.0
npm info lifecycle bindings@1.5.0~install: bindings@1.5.0
npm info lifecycle nan@2.13.2~install: nan@2.13.2
npm info lifecycle node-expat@2.3.17~install: node-expat@2.3.17
> node-expat@2.3.17 install E:\game\engine\node_modules\node-expat
> node-gyp rebuild
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli 'C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli 'rebuild' ]
gyp info using node-gyp@3.8.0
gyp info using node@11.14.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2.7" in the PATH
gyp verb `which` failed Error: not found: python2.7
gyp verb `which` failed at getNotFoundError (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed python2.7 { Error: not found: python2.7
gyp verb `which` failed at getNotFoundError (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:80:29)
gyp verb `which` failed at C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\which\which.js:89:16
gyp verb `which` failed at C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\isexe\index.js:42:5
gyp verb `which` failed at C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\isexe\windows.js:36:5
gyp verb `which` failed at FSReqCallback.oncomplete (fs.js:158:21)
gyp verb `which` failed stack:
gyp verb `which` failed 'Error: not found: python2.7\n at getNotFoundError (C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\which\\which.js:13:12)\n
at F (C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\which\\which.js:68:19)\n at E (C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\which\\which.js:80:29)\n at C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\which\\which.js:89:16\n at C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\isexe\\index.js:42:5\n at C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\isexe\\windows.js:36:5\n at FSReqCallback.oncomplete (fs.js:158:21)',
gyp verb `which` failed code: 'ENOENT' }
gyp verb could not find "python2.7". checking python launcher
gyp verb check python launcher python executable found: "C:\\Program Files\\Python2.7\\python.exe"
gyp verb check python version `C:\Program Files\Python2.7\python.exe -c "import sys; print "2.7.16
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 11.14.0
gyp verb command install [ '11.14.0' ]
gyp verb install input version string "11.14.0"
gyp verb install installing version: 11.14.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: 11.14.0
gyp verb build dir attempting to create "build" dir: E:\game\engine\node_modules\node-expat\build
gyp verb build dir "build" dir needed to be created? E:\game\engine\node_modules\node-expat\build
gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.Windows10SDK.17763
gyp verb find vs2017 - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
gyp verb find vs2017 - Found Microsoft.VisualStudio.VC.MSBuild.Base
gyp verb find vs2017 - Using this installation with Windows 10 SDK
gyp verb find vs2017 using installation: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: E:\game\engine\node_modules\node-expat\build\config.gypi
gyp verb config.gypi checking for gypi file: E:\game\engine\node_modules\node-expat\config.gypi
gyp verb common.gypi checking for gypi file: E:\game\engine\node_modules\node-expat\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Program Files\Python2.7\python.exe
gyp info spawn args [ 'C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\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 '-G',
gyp info spawn args 'msvs_version=2015',
gyp info spawn args '-I',
gyp info spawn args 'E:\\game\\engine\\node_modules\\node-expat\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\emil\\.node-gyp\\11.14.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\\emil\\.node-gyp\\11.14.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\emil\\.node-gyp\\11.14.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=E:\\game\\engine\\node_modules\\node-expat',
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 'E:\\game\\engine\\node_modules\\node-expat\\build',
gyp info spawn args '-Goutput_dir=.' ]
Warning: Missing input files:
E:\game\engine\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\libexpat\version.c
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\emil\.node-gyp\11.14.0
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:247:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:429:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:81:17)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\emil\\AppData\\Roaming\\nvm\\v11.14.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\game\engine\node_modules\node-expat
gyp ERR! node -v v11.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm verb lifecycle node-expat@2.3.17~install: unsafe-perm in lifecycle true
npm verb lifecycle node-expat@2.3.17~install: PATH: C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\game\engine\node_modules\node-expat\node_modules\.bin;E:\game\engine\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\emil\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\emil\AppData\Roaming\nvm;C:\Program Files\dotnet;C:\Program Files\Git\cmd;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Users\emil\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin;C:\Users\emil\.windows-build-tools\python27;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\emil\bin;C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Program Files\nodejs\node_modules\windows-build-tools\node_modules\.bin;C:\Program Files\nodejs\node_modules\.bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Users\emil\AppData\Roaming\nvm;C:\Program Files\dotnet;C:\Program Files\Git\cmd;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Users\emil\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files (x86)\Yarn\bin;C:\Users\emil\AppData\Local\Microsoft\WindowsApps;C:\Users\emil\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\Users\emil\AppData\Roaming\npm;C:\Users\emil\AppData\Local\Yarn\bin
npm verb lifecycle node-expat@2.3.17~install: CWD: E:\game\engine\node_modules\node-expat
npm info lifecycle node-expat@2.3.17~install: Failed to exec install script
npm timing action:install Completed in 1518ms
npm verb unlock done using C:\Users\emil\AppData\Roaming\npm-cache\_locks\staging-52648016cd19f6c3.lock for E:\game\engine\node_modules\.staging
npm timing stage:rollbackFailedOptional Completed in 27ms
npm timing stage:runTopLevelLifecycles Completed in 2800ms
npm WARN engine@0.0.1 No repository field.
npm verb stack Error: node-expat@2.3.17 install: `node-gyp rebuild`
npm verb stack Exit status 7
npm verb stack at EventEmitter.<anonymous> (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
npm verb stack at EventEmitter.emit (events.js:193:13)
npm verb stack at ChildProcess.<anonymous> (C:\Users\emil\AppData\Roaming\nvm\v11.14.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack at ChildProcess.emit (events.js:193:13)
npm verb stack at maybeClose (internal/child_process.js:999:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
npm verb pkgid node-expat@2.3.17
npm verb cwd E:\game\engine
npm verb Windows_NT 10.0.17134
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-expat" "--verbose"
npm verb node v11.14.0
npm verb npm v6.7.0
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! node-expat@2.3.17 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the node-expat@2.3.17 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 7, true ]
npm timing npm Completed in 3237ms
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\emil\AppData\Roaming\npm-cache\_logs\2019-05-09T16_27_17_130Z-debug.log
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\
does not contain MSBuild.exe, but C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\
does. Why does it use 2019? How can I configure node-gyp’s MSBuild path?
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (3 by maintainers)
Top Results From Across the Web
Npm install not installing because of node-gyp - Stack Overflow
stack Error: spawn D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT says MSBuild.exe doesn't ...
Read more >Build error MSBuild.exe ENOENT with new node version
Looks like there was a node upgrade on the build server. After that, our build started to fail. How can we choose a...
Read more >MSBuild.exe ENOENT - npm install 错误 - 全栈问答网
... ENOENT - uses VS2019 instead of VS2017. npm. This stackoverflow article is what helped me get over this, without having to uninstall...
Read more >Node.js stack Error: spawn C:\Program Files (x86)\Microsoft ...
System Windows_NT 10.0.18362 gyp ERR! command "E:\\Program ... MSBuild.exe ENOENT - uses VS2019 instead of VS2017 · Issue #1747 ...
Read more >Error npm install. (HELP!) - M220JS - MongoDB
After that, npm install run just fine. github.com/nodejs/node-gyp · Issue: MSBuild.exe ENOENT - uses VS2019 instead of VS2017.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This stackoverflow article is what helped me get over this, without having to uninstall VS 2019. https://stackoverflow.com/questions/33896511/npm-install-fails-with-node-gyp
I already had python 2.7 installed on my system, so the only thing I had to do in adition was to install Visual C++ Build tools from here, https://go.microsoft.com/fwlink/?LinkId=691126, and then configure npm to use python 2.7 and VS2015
After that, npm install run just fine.
node-gyp v5.0.0 is out with Visual Studio 2019 support. It’s not yet integrated into npm so it has to be installed manually. This should do it (only need to be run once):
Windows Command Prompt
Powershell
That is, install node-gyp globally and make the npm config variable
node_gyp
point tonode-gyp.js
.How to undo this after node-gyp is integrated into npm