2016-09-06 257 views
1

我想用npm安裝「松露」,但我不熟悉NodeJS,不能弄清楚爲什麼npm不會安裝它。我嘗試npm install -g truffle在PowerShell中具有管理員權限後輸出的幾行,我得到錯誤信息塊:NPM不能在Windows上安裝「松露」

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 (F:\nodeJS\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23) 
gyp ERR! stack  at emitTwo (events.js:87:13) 
gyp ERR! stack  at ChildProcess.emit (events.js:172:7) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) 
gyp ERR! System Windows_NT 10.0.14393 
gyp ERR! command "F:\\nodeJS\\node.exe" "F:\\nodeJS\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" 
gyp ERR! cwd C:\Users\Max\AppData\Roaming\npm\node_modules\truffle\node_modules\ether-pudding\node_modules\ethereumjs-testrpc\node_modules\ethereumjs-wallet\node_modules\scrypt.js\node_modules\scrypt 
gyp ERR! node -v v4.5.0 
gyp ERR! node-gyp -v v3.4.0 
gyp ERR! not ok\ 

再經過很多很多的黃線,我終於得到這個:

npm ERR! Windows_NT 10.0.14393 
npm ERR! argv "F:\\nodeJS\\node.exe" "F:\\nodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "truffle" 
npm ERR! node v4.5.0 
npm ERR! npm v2.15.9 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
npm ERR! This is most likely a problem with the scrypt 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 scrypt 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls scrypt 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  F:\eth_truffle\npm-debug.log 

後沒有其他事情發生,過了一段時間它就結束了。在我目前所在的目錄中沒有文件(除單個日誌文件外),cmd/powershell也找不到關鍵字「松露」。

正如我所說我以前從未與NodeJS合作過,也不知道這一切意味着什麼。我能做些什麼來讓松露運行?

回答

4

您的安裝未通過node-gyp rebuildnode-gyp repo上列出瞭解決此問題的方法。最快的是:

「選項1:使用來自升級的PowerShell或CMD.exe(以管理員身份運行)的npm install --global --production windows-build-tools,使用Microsoft的windows-build-tools安裝所有必需的工具和配置。這將正確安裝Python和Visual Studio。

此外,您正在使用節點4.5。推薦版本爲5+,根據Truffle Docs