13

編集

ノードをアップグレードし、「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 と何か関係があるかもしれないと読みましたが、どのように見えるべきかわかりません。

助けてくれてありがとう。

4

3 に答える 3

11

私は同じ問題を抱えていましたnode-gyp rebuild。解決策は install g++でした:

apt-get -y install g++
于 2014-03-14T13:04:52.537 に答える
4

元の問題

セグメンテーション違反: 11 ノード "dirname "$0"

これは、Clang でコンパイルすることによって明らかになった V8 のバグのようです。Node の最近のバージョンでは修正されているため、更新する必要があります。githubの問題はここで追跡されています

問題を編集

contextify実行できるコマンドライン プログラムがないため、何which contextifyも見つけることができません。モジュールは、モジュールをロードするために使用することによってcontextify内部で使用されることを意図しています。noderequire('contextify')

これをどのように説明したかに基づいて、2 つのことを混同しているように思われます。でインストールされたモジュールnpm install -gはグローバルにインストールされ、すべてのノード アプリケーションからアクセスできますが、コマンド ラインで実行できるスクリプトが公開されるわけではありません。-gモジュールのインストール パスのみを制御します。

モジュールに実行可能なコマンドライン スクリプトがあるかどうかは、モジュールがpackage.json一連のbinコマンド ( jshintなど) を定義しているかどうかによって異なります。と一緒にインストールすると-g、リストされているスクリプトは と一緒にシンボリック リンクされるnodeため、PATH. なしでインストールすると-g、bin スクリプトがインストールされ、スクリプトを機能さnode_modules/.binせるにはそのディレクトリを追加する必要がありますPATH

于 2014-01-16T01:42:29.263 に答える
0

contextifyバイナリのようなものはありません。contextify.nodeバイナリがあります/usr/lib/node_modules/contextify/build/Release/(私の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();
于 2014-01-16T00:27:13.490 に答える