Error installing contextify- node-gyp rebuild failed

雨燕双飞 提交于 2019-11-29 07:17:14

问题


Edit

I upgraded node and ran "npm install -g contextify" It looks like it installed fine (no errors), but typing in "which contextify" returns nothing. Message while installing 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

Original

I'm having a problem installing contextify with npm:

npm install -g contextify

and get the following error messages:

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

Anyone know what's going on here? I read that it may have something to do wit my PYTHON PATH, but I'm not sure how it should look.

Thanks for the help.


回答1:


Original problem

Segmentation fault: 11 node "dirname "$0"

This appears to be a bug in V8 exposed by compiling with Clang. It's been fixed in more recent versions of Node, so you'll need to update. The github issue is tracked here

Edit problem

There is no contextify command-line program that you can run, so which contextify has nothing to find. The contextify module is meant to be used within node by using require('contextify') to load the module.

Based on how you've described this, it seems like you may be conflating two things. Modules installed with npm install -g are installed globally and accessible to all node applications, but that does not mean that they will expose a script that can be executed on the command line. -g only controls the installation path of the module.

Whether a module has a command-line script you can run depends on whether the module's package.json defines a set of bin commands, e.g. jshint. When you install with -g, the scripts listed are symlinked along with node so they are accessible via your PATH. When installed without -g, bin scripts are installed into node_modules/.bin and you would have to add that directory to your PATH for scripts to work.




回答2:


I had the same problem with node-gyp rebuild. The solution was install g++:

apt-get -y install g++



回答3:


There is no such thing as contextify binary. There is contextify.node binary in /usr/lib/node_modules/contextify/build/Release/ (when installed globally in my ubuntu 12.04).

Just use the module in your node program by using require('contextify') and it should work.

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


来源:https://stackoverflow.com/questions/21148917/error-installing-contextify-node-gyp-rebuild-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!