Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
Asked Answered
F

4

10

I am trying to run an API. I get this error. I have uninstalled node modules, reinstalled, npm rebuild. I tried to install memwatch but that also gives errors. I have tried doing all types of restarts and reboots. I have to use Node 8.11.1 for this project, so I cannot change the version. Here is the complete error:

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 _errnoException (util.js:1022:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:372:16)
gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:180:9)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jackc\Documents\GitHub\blacqmarket\api\node_modules\memwatch-next
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
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 WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] 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\jackc\AppData\Roaming\npm-cache\_logs\2021-07-09T11_35_46_516Z-debug.log
Four answered 9/7, 2021 at 11:41 Comment(1)
any news on this?Barnes
A
5

it seems there an issue in olders npm, you could try first by npm install -g npm@latest, if this not work or you are not able to upgrade your node.js version, try by doing this

npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" -g
Ardeliaardelis answered 2/3, 2022 at 12:18 Comment(1)
I had a different path: npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe"Secure
S
2

I had the errors below on Windows 11:

NPM:

npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENT

Visual Studio:

spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENT

enter image description here

This configuration was correct for me with BuildTools 2019 and Windows 11:

npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" -g
Sperrylite answered 11/1, 2023 at 17:13 Comment(1)
It work for me on Windows 11Sodomy
N
1

In my case the only thing that worked on Windows 11 was specifying the build path manually (use yours):

npm install hnswlib-node --msbuild_path="C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
Nomenclature answered 3/8, 2023 at 11:15 Comment(0)
S
0

If you are done with Visual Studio 2019 and have moved on to Visual Studio 2022 you can try this solution. I had build tools for Visual Studio 2017, 2019, and 2022. I uninstalled visual studio 2019 and its corresponding build tools and that fixed the issue. Note: After uninstalling the 2019 visual studio and the 2019 build tools that 2019 folder should be empty.

enter image description here

Sinciput answered 2/3, 2023 at 18:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.