【问题标题】:getting errors while doing npm in my project在我的项目中执行 npm 时出错
【发布时间】:2015-12-18 20:41:16
【问题描述】:

我正在执行 npm install 并收到这些错误。无法弄清楚到底发生了什么或我在这里真正想念什么。我尝试手动安装 node-gyp,但是当我尝试运行 gulp 时,我得到“找不到命令”。很郁闷

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

【问题讨论】:

  • 请标记答案,我需要加分,谢谢:)

标签: node.js


【解决方案1】:

这是一个known issue,带有 gyp/node-gyp,影响所有平台。

node-gyp 不再受到积极支持,因此它不适用于较新版本的 Node.js。你需要卸载 4.1.0,所以如果你使用 Homebrew:

sudo brew uninstall node.js

然后安装适用于我的 0.12.7 版本(我也在 Mac OSX - Darwin 14.5.0 上)。我通过从nodejs.org 下载 pkg 安装了 0.12.7。

【讨论】:

  • 这个答案(正确的)太难找了!!谢谢 :)
  • 天哪,谢谢。我花了几个小时才弄清楚。如果有人在尝试使用 sprity / sprity-sass 时遇到此问题:stackoverflow.com/questions/33500066/…
【解决方案2】:

lwip 包需要在安装时构建,看起来你没有一个(或多个)这个包(gcc、g++、make),所以尝试运行sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make,然后再试一次

【讨论】:

  • 当我尝试运行 sudo sudo apt-get install gcc 时找不到命令
  • 对不起,我以为你在 ubuntu 上。我不知道如何在 OS X 上安装软件包,但我想你知道,所以你应该安装它们。
【解决方案3】:

我按照https://github.com/nodejs/node-gyp#installation 处的说明将 npm 设置为指向 python v2.7 的首选版本,从而解决了“node-gyp rebuild”问题。我在使用 node v4.2.4 和 node-gyp v3.5.0 的 Ubuntu 14.0.4 上安装 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-08
    • 1970-01-01
    • 2021-10-17
    • 2021-04-12
    • 1970-01-01
    • 2020-12-01
    • 1970-01-01
    相关资源
    最近更新 更多