node.js - mac 中的 "node-gyp rebuild"错误

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

我想关注this page在本地运行 JSBin。

我刚刚在我的 mac 上安装了 xcode 8.2。现在,npm -v 返回 3.10.9node -v 返回 v7.2.1。但是,npm install 引发了错误:

/Users/softtimur/Startup/WebProjects/jsbin$ npm install

> hashring@3.0.0 install /Users/softtimur/Startup/WebProjects/jsbin/node_modules/hashring
> node-gyp rebuild

  CXX(target) Release/obj.target/hashvalue/src/hashvalue.o
In file included from ../src/hashvalue.cc:1:
../../nan/nan.h:189:68: error: too many arguments to function call, expected at most 2, have 4
    return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
...
...
...
...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
13 warnings and 20 errors generated.
make: *** [Release/obj.target/hashvalue/src/hashvalue.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:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.1.0
gyp ERR! command "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/softtimur/Startup/WebProjects/jsbin/node_modules/hashring
gyp ERR! node -v v7.2.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN mocha-casperjs@0.5.8 requires a peer of casperjs@>= 1.1.0-beta3 but none was installed.
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/Cellar/node/7.2.1/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.2.1
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE

npm ERR! hashring@3.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hashring@3.0.0 install script 'node-gyp rebuild'.
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 hashring 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 hashring
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls hashring
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/softtimur/Startup/WebProjects/jsbin/npm-debug.log

有人知道这里出了什么问题吗?

最佳答案

将 Node 降级到 v10,如下所示:

brew uninstall node

brew install node@10

brew link --force --overwrite node@10

npm i 现在应该没有错误地完成了。

关于node.js - mac 中的 "node-gyp rebuild"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41250652/

相关文章:

node.js - 打开 api 错误 : request should have required property '.headers' - docker

node.js - Puppeteer - 如何使用代理浏览 google.com?

linux - Nodejs 更新将旧版本保留为当前版本

intellij-idea - 在Idea中使用Angular2 TypeScript开发Spring Boot应用程序:gradle process

node.js - 当我尝试在 cPanel 上安装 Laravel 时出现 pngquant 错误

node.js - 使用 npm install 时移除 React-native

node.js - npm 错误!跟踪器 "idealTree:inflate:"已经存在

json - 有没有办法自动将 package.json 的最新或星号(*)标记更改为特定版本?

node.js - TypeScript OutDir 包含 package.json

node.js - NPM 安装错误 :Unexpected end of JSON input while parsing near '...nt-webpack-plugin" :"0'