首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装上下文-节点-gyp重建失败

安装上下文-节点-gyp重建失败
EN

Stack Overflow用户
提问于 2014-01-15 21:46:31
回答 3查看 20.3K关注 0票数 13

编辑

我升级了节点并运行了"npm -g like“--看起来它安装得很好(没有错误),但是键入"which”就什么都没有了。在安装上下文时发出消息:

代码语言:javascript
复制
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

  > contextify@0.1.6 install /usr/local/share/npm/lib/node_modules/contextify
  > node-gyp rebuild

CXX(target) Release/obj.target/contextify/src/contextify.o
SOLINK_MODULE(target) Release/contextify.node
SOLINK_MODULE(target) Release/contextify.node: Finished
contextify@0.1.6 /usr/local/share/npm/lib/node_modules/contextify
└── bindings@1.1.1

原始

我在用npm安装上下文时遇到了问题:

代码语言:javascript
复制
npm install -g contextify

并获得以下错误消息:

代码语言:javascript
复制
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/contextify
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> contextify@0.1.6 install /usr/local/share/npm/lib/node_modules/contextify
> node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o
  SOLINK_MODULE(target) Release/contextify.node
  SOLINK_MODULE(target) Release/contextify.node: Finished
/usr/local/Cellar/node/0.10.1/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: line 2: 73593 Segmentation fault: 11  node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@"

npm ERR! contextify@0.1.6 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 139
npm ERR! 
npm ERR! Failed at the contextify@0.1.6 install script.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.1/bin/node" "/usr/local/bin/npm" "install" "-g" "contextify"
npm ERR! cwd /Users/projects/
npm ERR! node -v v0.10.1
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE

有人知道这是怎么回事吗?我读到它可能与我的PYTHON路径有关,但我不知道它应该是什么样子。

谢谢你的帮助。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-01-16 01:42:29

原问题

分割故障:11个节点"dirname "$0"

这似乎是通过用Clang编译而暴露的V8中的一个bug。它已经在新版本的Node中得到了修正,所以您需要进行更新。github问题被跟踪这里

编辑问题

没有可以运行的contextify命令行程序,所以which contextify没有什么可查找的。contextify模块用于在node中使用require('contextify')来加载该模块。

根据你对此的描述,你可能会把两件事混为一谈。与npm install -g一起安装的模块是全局安装的,所有节点应用程序都可以访问这些模块,但这并不意味着它们将公开一个可以在命令行上执行的脚本。-g只控制模块的安装路径。

模块是否可以运行命令行脚本取决于模块的package.json是否定义了一组bin命令,例如jshint。当您使用-g安装时,列出的脚本与node一起被符号链接,因此可以通过您的PATH访问它们。在没有-g的情况下安装时,bin脚本将安装到node_modules/.bin中,您必须将该目录添加到您的PATH中,以便脚本工作。

票数 4
EN

Stack Overflow用户

发布于 2014-03-14 13:04:52

我对node-gyp rebuild也有同样的问题。解决方案是安装g++

代码语言:javascript
复制
apt-get -y install g++
票数 11
EN

Stack Overflow用户

发布于 2014-01-16 00:27:13

没有像contextify二进制那样的东西。在contextify.node中有/usr/lib/node_modules/contextify/build/Release/二进制文件(当全局安装在我的ubuntu12.04中时)。

只要使用require('contextify')在节点程序中使用模块,它就能工作。

代码语言:javascript
复制
var Contextify = require('contextify');
var sandbox = Contextify(); // returns an empty contextified object.
sandbox.run('var x = 3;');
console.log(sandbox.x); // prints 3
sandbox.dispose();
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21148917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档