web-dev-qa-db-ja.com

contextify-node-gypの再構築のインストール中にエラーが発生しました

編集

ノードをアップグレードして「npminstall-g contextify」を実行しました。正常にインストールされたようです(エラーなし)が、「whichcontextify」と入力しても何も返されません。 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

  > [email protected] 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
[email protected] /usr/local/share/npm/lib/node_modules/contextify
└── [email protected]

オリジナル

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

> [email protected] 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! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 139
npm ERR! 
npm ERR! Failed at the [email protected] 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と関係があるかもしれないと読みましたが、どのように表示されるかわかりません。

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

13
ukejoe

元の問題

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

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

問題の編集

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

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

モジュールに実行できるコマンドラインスクリプトがあるかどうかは、モジュールの_package.json_が一連のbinコマンドを定義しているかどうかによって異なります。 jshint 。 _-g_を使用してインストールすると、リストされているスクリプトはnodeとともにシンボリックリンクされるため、PATHからアクセスできます。 _-g_なしでインストールすると、binスクリプトは_node_modules/.bin_にインストールされ、スクリプトを機能させるには、そのディレクトリをPATHに追加する必要があります。

4
loganfsmyth

node-gyp rebuildでも同じ問題が発生しました。解決策はインストールでしたg ++

apt-get -y install g++
11
maxcnunes

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();
_
1
vinayr