简体   繁体   中英

Unable to install leveldown npm package, node-gyp error MSBuild.exe failed with exit code: 1

  • Node Version: node: v12.13.0 npm: 6.12.0
  • Platform: windows 10

While trying to install levelDown, installation failing at node-gyp

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\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:194:23)
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.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 D:\Source\Project\node_modules\leveldown
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5

Things i have tried to fix this issue:

  • Installed python latest version
  • Installed visual studio 2017 community version with c++ dev tools
  • set VCTargetsPath and MSBuild enviroments variables
  • set VCTargetsPath in windows registry
  • Tried running npm install --global --production windows-build-tools

but nothing seems to work so far

please help

SO after trying many things found out that the issue was with Node version, i was using node version 12.0.0, tried downgrading to version 11.15.0 and it worked.

I had a problem where the install of leveldown as a dependency was making another package ( orbit-db-http-api ) fail. It was an old version of leveldown in the package-lock.json, so that even explicitly installing the latest version npm i leveldown@5.0.3 failed with:

> leveldown@5.0.3 install /home/teide/randomCode/OrbitDB/orbit-db-http-api/node_modules/orbit-db-cache/node_modules/leveldown
> node-gyp-build


> leveldown@3.0.2 install /home/teide/randomCode/OrbitDB/orbit-db-http-api/node_modules/orbit-db-keystore/node_modules/leveldown
> prebuild-install || node-gyp rebuild

Deleting the package-lock.json that came with the repo and reinstalling did the trick (without needing to downgrade Node)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM