在我的项目中做npm的时候出错

我正在做npm安装并获取这些错误。 不知道究竟是怎么回事,或者我真的在这里错过了什么。 我尝试手动安装node-gyp,但是当我尝试运行吞咽我得到“命令未find”。 完全令人沮丧

16 errors generated. make: *** [Release/obj.target/lwip_decoder/src/decoder/init.o] Error 1 gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270: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 Darwin 14.5.0 gyp ERR! command "/usr/local/Cellar/node/4.1.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/soum/Documents/movado/preprocessed/node_modules/css-sprite/node_modules/lwip gyp ERR! node -v v4.1.0 gyp ERR! node-gyp -v v3.0.1 gyp ERR! not ok npm ERR! Darwin 14.5.0 npm ERR! argv "/usr/local/Cellar/node/4.1.0/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v4.1.0 npm ERR! npm v2.14.4 npm ERR! code ELIFECYCLE npm ERR! lwip@0.0.6 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the lwip@0.0.6 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the lwip 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 lwip npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /Users/soum/Documents/movado/preprocessed/npm-debug.log 

这是影响所有平台的gyp / node-gyp的已知问题 。

node-gyp不再被主动支持,所以它不适用于较新版本的Node.js。 你需要卸载4.1.0,所以如果你使用的是自制软件:

 sudo brew uninstall node.js 

然后安装版本0.12.7,它为我工作(我也在Mac OSX – 达尔文14.5.0)。 我通过从nodejs.org下载pkg来安装0.12.7 。

我通过设置npm指向Python v2.7的首选版本解决了“ node-gyp rebuild ”问题,按照https://github.com/nodejs/node-gyp#installation中的说明操作。 我遇到了这个问题在Ubuntu 14.0.4上安装节点v4.2.4和node-gyp v3.5.0的lwip 。 解决它:

 $ whereis python python: /usr/bin/python /usr/bin/python3.4m /usr/bin/python2.7 $ npm config set python /usr/bin/python2.7 $ npm install lwip 

lwip包需要build立在安装上,它看起来像你没有一个(或多个)这个包(gcc,g ++,make),所以试着运行sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make ,然后重试