npm安装失败,并出现node-gyp构建错误

时间:2016-10-04 14:42:55

标签: node.js build npm npm-install node-gyp

今天当我运行npm install时,它失败并给我以下错误日志。我知道这是哈希表的一个问题,但我之前从未遇到过这个问题。

> hashtable@2.0.2 install /Users/admin/myproject/node_modules/hashtable
> node-gyp configure build

  CXX(target) Release/obj.target/native/src/hashtable.o
  SOLINK_MODULE(target) Release/native.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/native.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/admin/.npm-packages/lib/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 Darwin 15.5.0
gyp ERR! command "/usr/local/bin/node" "/Users/admin/.npm-packages/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/admin/myproject/node_modules/hashtable
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
myproject@0.0.1 /Users/admin/myproject
└── (empty)

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/Users/admin/.npm-packages/bin/npm" "install"
npm ERR! node v4.4.7
npm ERR! npm  v3.10.5
npm ERR! code ELIFECYCLE

npm ERR! hashtable@2.0.2 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hashtable@2.0.2 install script 'node-gyp configure build'.
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 hashtable package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs hashtable
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hashtable
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/admin/myproject/npm-debug.log
npm ERR! code 1

我认为node-gyp可能存在问题,所以我分别做了npm install node-gyp -g,但问题并没有消失。有谁知道如何解决这个问题?

顺便说一下,我在Mac上运行OSX 10.11.5,最近也安装了XCode 6.3.2用于单独的项目,并且只能使用这个版本的XCode,不确定是否会导致问题。

1 个答案:

答案 0 :(得分:0)

node-gyp还需要在MacOs上使用python和xcode进行C ++编译。其他系统也有类似的要求。

您可以在npm页面here上找到node-gyp包的pre-req。