繁体   English   中英

安装contextify-node-gyp rebuild时出错

[英]Error installing contextify- node-gyp rebuild failed

编辑

我升级了节点并运行了“npm install -g contextify”看起来它安装得很好(没有错误),但输入“which contextify”什么都不返回。 安装contextify时的消息:

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安装contextify时遇到问题:

npm install -g contextify

并获取以下错误消息:

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 PATH有关,但我不确定它应该如何。

谢谢您的帮助。

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

apt-get -y install g++

原来的问题

分段错误:11个节点“ dirname "$0"

这似乎是通过使用Clang进行编译而暴露的V8中的错误。 它已在更新版本的Node中修复,因此您需要更新。 这里跟踪github问题

编辑问题

没有可以运行的contextify命令行程序,因此which contextify无法找到。 contextify模块旨在通过使用require('contextify')加载模块在node内使用。

根据你对此的描述,似乎你可能会混淆两件事。 使用npm install -g安装的模块全局安装并可供所有节点应用程序访问,但这并不意味着它们将公开可在命令行上执行的脚本。 -g仅控制模块的安装路径。

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

没有contextify这样的东西。 /usr/lib/node_modules/contextify/build/Release/contextify.node二进制文件(在我的ubuntu 12.04中全局安装时)。

只需使用require('contextify')在节点程序中使用该模块即可。

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();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM