Error installing contextify- node-gyp rebuild failed

不羁岁月 提交于 2019-11-30 07:03:09

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.

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

apt-get -y install g++

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