node-gyp: NPM fails on msbuild.exe with exit code 1

The printout from cmd:

C:\Users\Gilbert>cd webstormprojects/nodeofgames

C:\Users\Gilbert\WebstormProjects\NodeOfGames>npm install bcrypt --save
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
npm http GET https://registry.npmjs.org/bindings/1.0.0
npm http 304 https://registry.npmjs.org/bindings/1.0.0

> bcrypt@0.7.1 install C:\Users\Gilbert\WebstormProjects\NodeOfGames\node_module
s\bcrypt
> node-gyp rebuild


C:\Users\Gilbert\WebstormProjects\NodeOfGames\node_modules\bcrypt>node "C:\Progr
am Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node
-gyp\bin\node-gyp.js" rebuild
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(29
7,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.
  TargetFrameworkVersion or PlatformToolset may be set to an invalid version nu
mber. [C:\Users\Gilbert\WebstormProjects\NodeOfGames\node_modules\bcrypt\build\
bcrypt_lib.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp
.Win32.Targets(147,5): error MSB6006: "CL.exe" exited with code -1073741515. [C
:\Users\Gilbert\WebstormProjects\NodeOfGames\node_modules\bcrypt\build\bcrypt_l
ib.vcxproj]
gyp ERR! rebuild error Error: `C:\windows\Microsoft.NET\Framework\v4.0.30319\msb
uild.exe` failed with exit code: 1
gyp ERR! rebuild error     at ChildProcess.onExit (C:\Program Files (x86)\nodejs
\node_modules\npm\node_modules\node-gyp\lib\build.js:214:23)
gyp ERR! rebuild error     at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! rebuild error     at Process._handle.onexit (child_process.js:674:10)
gyp ERR! not ok
npm ERR! bcrypt@0.7.1 install: `node-gyp rebuild`
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the bcrypt@0.7.1 install script.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt" "--save"

npm ERR! cwd C:\Users\Gilbert\WebstormProjects\NodeOfGames
npm ERR! node -v v0.8.1
npm ERR! npm -v 1.1.33
npm ERR! code ELIFECYCLE
npm ERR! message bcrypt@0.7.1 install: `node-gyp rebuild`
npm ERR! message `cmd "/c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Gilbert\WebstormProjects\NodeOfGames\npm-debug.log
npm ERR! not ok code 0

C:\Users\Gilbert\WebstormProjects\NodeOfGames>

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 48 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Honestly I don’t know, you’re gonna have to figure that out.

I also faced same Error on MSBuild.exe with Window 7 and window 10 64bit machine. I had tried number of attempt with installation of windows-build-tools global but got repeated failure. But when i install windows-build-tools local folder, i got the success. ( npm install --production windows-build-tools )

I’m sorry, this is a bcrypt issue at this point. You’ll need to open an issue over at that repo.

Ok so try updating node-gyp. From that same directory:

$ npm install node-gyp

I am with a Windows 10 (64 bit) computer and I have experienced the very same issue. I managed to get it solved and here are my key steps taken:

  1. Install the latest versions of Python (it may not be related😅), and “Microsoft Visual C++ Redistributable for Visual Studio 2017”, and of course, Node.js and NPM;
  2. As Admin: $ cd “C:\Program Files\nodejs\node_modules\npm” $ npm install node-gyp
  3. $ npm config set msvs_version 2015 --global Note that I have VS 2017, but configuring it as ver 2017 won’t work. Not sure why.
  4. As Admin: $ npm install -g node-sass And finally, one last check: $ node-sass -v

Hope this can help you solve your problem. 😄

Oh, sorry, you need to do that from a Command Prompt with Administrator privileges. Right click on cmd and do “run as administrator” and try again.

oh boy, nevermind: updating Everything™ to the latest version worked out well shame. Thanks anyway and have a nice weekend! TGIF yay.

The real problem of this issue is variable setup , the “VCTargetsPath” 's variable was difference between window server and window 10.

If you used window 10, it need to set “VCTargetsPath” with set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140

If you used widows server above command, it will give you some error then you need to set this variable via window system tool: System Properties>Environment Variables>System variables>New

Then you need to set variable to VCTargetsPath and value is C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140

Hi, I am facing issue in **npm install bufferutil _. It’s giving the error _msbuild failed with exit code 1 I have done all the things mentioned by @mousetraps for node gyp issue. I have latest version of node (v6. 3. 1), npm(v3. 10. 3), node gyp(v3. 3. 1) installed on my windows 7 machine.

Done following steps for node gyp issue.

1.Install VC++ Build Tools Technical Preview, choose Custom Install, and select both Windows 8.1 and Windows 10 SDKs.

2.Install Python 2.7, and add it to your PATH

3.npm config set python python2.7 --global

4.npm config set python C:\Python27\python.exe --global

5.npm config set msvs_version 2015 --global

6.set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140

Errors: msbuild error.txt

Please help

Caused by node-sass generally. So you should do this in your project directory.

First,

npm un node-sass 
// or
yarn remove node-sass

Then,

npm i node-sass --save-dev
// or
yarn add node-sass --dev

If you are using node v13 or later it may not work due to node-sass being buggy.

Try using nvm and change to an earlier version of node. I tried with node v10 and it worked fine.

getting error like : gyp ERR! build error gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12) gyp ERR! System Windows_NT 10.0.17763 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:\appLatest\appLatest\node_modules\voicemeeter\node_modules\ffi gyp ERR! node -v v10.15.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 7zip-bin-linux@1.2.0 (node_modules\7zip-bin-linux): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 7zip-bin-linux@1.2.0: wanted {“os”:“linux”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! ffi@2.2.0 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ffi@2.2.0 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\alliancetek\AppData\Roaming\npm-cache_logs\2019-02-05T10_55_54_298Z-debug.log

Thanks ganesh buddy, you have save my day,. i have spent for almost 2days,

npm install --production windows-build-tools

Finally its working now man, thanks.

Below i have posted my error and issue 👍


C:\Users\Administrator\Downloads\New\radio>npm install xml2json

> node-expat@2.3.16 install C:\Users\Administrator\Downloads\New\radio\node_modu
les\node-expat
> node-gyp rebuild

C:\Users\Administrator\Downloads\New\radio\node_modules\node-expat>if not defined npm_config_node_gyp (node "C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild)  else (node "" rebuild )Warning: Missing input files:C:\Users\Administrator\Downloads\New\radio\node_modules\node-expat\build\deps\libexpat\..\..\..\deps\libexpat\version.c
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  xmlparse.c
  xmltok.c
  xmlrole.c
  win_delay_load_hook.cc
  expat.vcxproj -> C:\Users\Administrator\Downloads\New\radio\node_modules\node
  -expat\build\Release\\libexpat.lib
  node-expat.cc
  win_delay_load_hook.cc
C:\Users\Administrator\Downloads\New\radio\node_modules\nan\nan.h(76): fatal er
ror C1060: compiler is out of heap space (..\node-expat.cc) [C:\Users\Administr
ator\Downloads\New\radio\node_modules\node-expat\build\node_expat.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Administrator\AppData\Roamin
g\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:219:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Adminis
trator\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\n
ode-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Administrator\Downloads\New\radio\node_modules\node-expat
gyp ERR! node -v v6.11.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
quickbooks-js@1.0.0 C:\Users\Administrator\Downloads\New\radio
`-- (empty)

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Administra
tor\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "xml2j
son"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! node-expat@2.3.16 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-expat@2.3.16 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs node-expat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Administrator\Downloads\New\radio\npm-debug.log
npm ERR! code 1

ganeshkatore comment

Try using nvm and change to an earlier version of node. I tried with node v10 and it worked fine.

when someone (like me) use Discord.js v12, Node.js v13+ is required

i’ve installed Openssl but there’s no change, the lines:

c:\users\gilbert.node-gyp\0.8.1\deps\openssl\openssl\include\openssl…/…/e_os2.h(56): fatal error C1083: Cannot open include file: ‘openssl/opensslconf.h’: No such file or directory [c:\Users\Gilbert\WebstormProjects\NodeOfGames\node_ modules\bcrypt\build\bcrypt_lib.vcxproj]

are red

Nathan Rajlich wrote:

Honestly I don’t know, you’re gonna have to figure that out.

— Reply to this email directly or view it on GitHub https://github.com/TooTallNate/node-gyp/issues/119#issuecomment-7536455.

Check that your VS actually has C++ installed (just an option in Community editions) try https://www.visualstudio.com/downloads/ near the bottom of the page for the installer to be on the safe side.