Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack Error: spawn msbuild ENOENT (Node 9.10.0 and higher) #1414

Closed
jochemstoel opened this issue Apr 14, 2018 · 7 comments
Closed

stack Error: spawn msbuild ENOENT (Node 9.10.0 and higher) #1414

jochemstoel opened this issue Apr 14, 2018 · 7 comments
Labels

Comments

@jochemstoel
Copy link

A few days ago node-gyp started throwing errors when compiling native modules. It doesn't matter what module I am trying to build. I did not install or uninstall anything and am using the same version of Node as always.

What's going on?

c:\Users\Administrator\Desktop>npm i sleep

> sleep@5.1.1 install c:\Users\Administrator\Desktop\node_modules\sleep
> node-gyp rebuild


c:\Users\Administrator\Desktop\node_modules\sleep>if not defined npm_config_node_gyp (node "C:\bin\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\bin\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn msbuild ENOENT
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
gyp ERR! stack     at onErrorNT (internal/child_process.js:379:16)
gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:114:19)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\bin\\nodejs\\node.exe" "C:\\bin\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\Users\Administrator\Desktop\node_modules\sleep
gyp ERR! node -v v9.10.0
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 enoent ENOENT: no such file or directory, open 'c:\Users\Administrator\Desktop\package.json'
npm WARN Desktop No description
npm WARN Desktop No repository field.
npm WARN Desktop No README data
npm WARN Desktop No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! sleep@5.1.1 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the sleep@5.1.1 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\Administrator\AppData\Roaming\npm-cache\_logs\2018-04-14T09_22_04_205Z-debug.log
@bnoordhuis
Copy link
Member

node-gyp is trying to execute msbuild but it's nowhere to be found.

If it worked before that probably means your Visual Studio or Windows Build Tools install is botched or misconfigured (not on the path.)

@jochemstoel
Copy link
Author

Thanks Ben. It turns out it got messed up because I installed the Mono runtime which contains its own msbuild.exe in a directory that is also added to PATH.
For some reason the PATH values from Visual Studio 2015/2017 were removed entirely but figuring out which values to add back in should be fairly easy.

@nevercast
Copy link

nevercast commented May 25, 2018

I'm on Windows 10, using Node v9.11.1, trying to install speaker from npm, getting this same error. msbuild is in my path however, it seems that if I do which msbuild I also get Program Files/Mono/bin/msbuild

What did you change @jochemstoel to get it working? It would be great to have the concrete answer in this issue so future visitors (like myself) can quickly resolve the issue.

@jochemstoel
Copy link
Author

@nevercast I simply uninstalled Mono.

@nevercast
Copy link

@jochemstoel I didn't manage to get my build working before EOW last Friday, so I'll tackle that this week. But removing Mono didn't resolve my problem. So what I'll do is retract my initial blurb and create a new issue for it. After I re-read the node-gyp instructions for setup.

Thanks for the reply.

@ghost
Copy link

ghost commented Dec 12, 2018

My solution to remove C:\Program Files\Mono\bin\ from PATH.

@joelcancela
Copy link

@megyer This solved my problem, thanks !

@rvagg rvagg closed this as completed Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants