2013-02-28 4 views
140

Node.jsのコードベースに入ると、NPM、つまりjQuery経由でいくつかの依存関係をダウンロードする必要があります。WindowsでNode.jsの依存関係のためにPythonを実行する

npm install jqueryを実行しようと、私はこのエラーを取得しておいてください。

Your environment has been set up for using Node.js 0.8.21 (x64) and NPM 

C:\Users\Matt Cashatt>npm install jquery 
npm http GET https://registry.npmjs.org/jquery 
npm http 304 https://registry.npmjs.org/jquery 
npm http GET https://registry.npmjs.org/jsdom 
npm http GET https://registry.npmjs.org/xmlhttprequest 
npm http GET https://registry.npmjs.org/htmlparser/1.7.6 
npm http GET https://registry.npmjs.org/location/0.0.1 
npm http GET https://registry.npmjs.org/navigator 
npm http GET https://registry.npmjs.org/contextify 
npm http 304 https://registry.npmjs.org/htmlparser/1.7.6 
npm http 304 https://registry.npmjs.org/xmlhttprequest 
npm http 304 https://registry.npmjs.org/location/0.0.1 
npm http 304 https://registry.npmjs.org/navigator 
npm http 304 https://registry.npmjs.org/jsdom 
npm http 304 https://registry.npmjs.org/contextify 
npm http GET https://registry.npmjs.org/bindings 
npm http GET https://registry.npmjs.org/cssom 
npm http GET https://registry.npmjs.org/cssstyle 
npm http GET https://registry.npmjs.org/request 
npm http 304 https://registry.npmjs.org/bindings 

> [email protected] install C:\Users\Matt Cashatt\node_modules\jquery\node_module 
s\contextify 
> node-gyp rebuild 


C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify>node "C:\Progr 
am Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\b 
in\node-gyp.js" rebuild 
npm http 304 https://registry.npmjs.org/cssstyle 
npm http 304 https://registry.npmjs.org/cssom 
npm http 304 https://registry.npmjs.org/request 
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT 
HON env variable. 
gyp ERR! stack  at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod 
e_modules\node-gyp\lib\configure.js:113:14) 
gyp ERR! stack  at C:\Program Files\nodejs\node_modules\npm\node_modules\node 
-gyp\lib\configure.js:82:11 
gyp ERR! stack  at Object.oncomplete (fs.js:297:15) 
gyp ERR! System Windows_NT 6.1.7601 
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu 
les\\node-gyp\\bin\\node-gyp.js" "rebuild" 
gyp ERR! cwd C:\Users\Matt Cashatt\node_modules\jquery\node_modules\contextify 
gyp ERR! node -v v0.8.21 
gyp ERR! node-gyp -v v0.8.4 
gyp ERR! not ok 
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Matt Cashatt\node_ 
modules\jquery\node_modules\jsdom\node_modules\request\tests' 
npm ERR! error rolling back [email protected] { [Error: ENOTEMPTY, rmdir 'C:\Users\M 
att Cashatt\node_modules\jquery\node_modules\jsdom\node_modules\request\tests'] 
npm ERR! error rolling back errno: 53, 
npm ERR! error rolling back code: 'ENOTEMPTY', 
npm ERR! error rolling back path: 'C:\\Users\\Matt Cashatt\\node_modules\\jque 
ry\\node_modules\\jsdom\\node_modules\\request\\tests' } 
npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1 
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 Windows_NT 6.1.7601 
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod 
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jquery" 
npm ERR! cwd C:\Users\Matt Cashatt 
npm ERR! node -v v0.8.21 
npm ERR! npm -v 1.2.11 
npm ERR! code ELIFECYCLE 
npm ERR! Error: ENOENT, lstat 'C:\Users\Matt Cashatt\node_modules\jquery\node_mo 
dules\jsdom\node_modules\request\tests\test-pipes.js' 
npm ERR! If you need help, you may report this log at: 
npm ERR!  <http://github.com/isaacs/npm/issues> 
npm ERR! or email it to: 
npm ERR!  <[email protected]> 

npm ERR! System Windows_NT 6.1.7601 
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod 
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "jquery" 
npm ERR! cwd C:\Users\Matt Cashatt 
npm ERR! node -v v0.8.21 
npm ERR! npm -v 1.2.11 
npm ERR! path C:\Users\Matt Cashatt\node_modules\jquery\node_modules\jsdom\node_ 
modules\request\tests\test-pipes.js 
npm ERR! fstream_path C:\Users\Matt Cashatt\node_modules\jquery\node_modules\jsd 
om\node_modules\request\tests\test-pipes.js 
npm ERR! fstream_type File 
npm ERR! fstream_class FileWriter 
npm ERR! code ENOENT 
npm ERR! errno 34 
npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fst 
ream\lib\writer.js:284:26 
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15) 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  C:\Users\Matt Cashatt\npm-debug.log 
npm ERR! not ok code 0 

C:\Users\Matt Cashatt> 

障害が欠落しているPythonのインストールが原因であるように見えます。まあ、私はPythonをインストールして、変数を設定し、リブートしてもエラーが発生します。

私が紛失しているものは何ですか?

+0

あなたがテキストとして、代わりに画像のテキストを貼り付けることはできますか? (特に低解像度のビットマップフォントに縮小されているので)読みにくいだけでなく、コピーできません。 – abarnert

+1

もっと重要な点:リブートする前に環境変数をどのように設定しましたか? cmdウィンドウで 'PYTHON = C:\ Python27 \ Python.exe'を実行してリブートしただけでは、設定は失われました。 – abarnert

+6

また、どのPythonバージョンをインストールしましたか?少なくとも古いバージョンのwafとgypは2.xを必要としましたが、何も言わなかったので、3.xをインストールした場合、あらゆる種類の不思議なエラーが発生します。 – abarnert

答えて

92

あなたの問題は、に環境変数を設定していないことです。うれしいです

set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib 

が、それはそれはセット、PYTHON変数を設定しません:

エラー明確に、これは言う:

gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. 

そして、あなたのコメントで、あなたはこれをしなかったと言いますPYTHONPATH変数。


一方、ちょうどsetコマンドを使用すると、現在cmdのセッションに影響を与えます。それ以降にリブートすると、あなたが言ったように、新しい変数cmdにはその変数が設定されていないまったく新しいものになります。

環境変数を永久に設定するにはいくつかの方法があります。最も簡単なのはXPのシステムコントロールパネルですが、Vistaではもちろん異なりますが、7でもう一度異なりますが、8でもう一度違いますが、それ。

また、をnpmコマンドの直前で実行し、その間にリブートする必要はありません。


あなたは右のconfigスクリプトがやろうとしているまったく同じことをすることによって、あなたは物事をやったかどうかをテストすることができ :npmを実行する前に、実行してみてください%PYTHON%。あなたが正しく行っていれば、Pythonインタプリタを手に入れます(すぐに終了できます)。エラーが発生した場合は、正しく実行していません。


これには二つの問題があります。

set PYTHON=%PYTHON%;D:\Python 

まず、あなたは;D:\PythonからPYTHONを設定しています。セミコロンで区切られたパスのリストは、PYTHONのような単一の値ではなく、PATHまたはPYTHONPATHのようなセミコロンで十分です。同様に、既存の値に新しい値を追加することは、パスのリストに別のパスを追加したいが、単一の値を追加したくない場合に必要なものです。だから、ちょうどset PYTHON=D:\Pythonがほしいと思う。

次に、D:\PythonはPythonインタープリタへのパスではありません。それはD:\Python\Python.exe、またはD:\Python\bin\Python.exeのようなものです。適切なパスを見つけて、それが自分で動作することを確認します(例:D:\Python\bin\Python.exeと入力し、Pythonインタープリタを入手してください)、変数を設定して使用してください。


ので:

set PYTHON=D:\Python\bin\Python.exe 

それとも、あなたはそれを恒久的なものにしたい場合は、コントロールパネルで同等の操作を行います。

+1

OKですので、私はこれを取得します:Microsoft Windows [Version 6.1.7601] Copyright(c)2009 Microsoft Corporation。全著作権所有。 C:\ユーザーマットCashatt>設定PYTHON =%のPYTHONを\%; D:\ Pythonの C:\ユーザーマットCashatt>%のPythonは% '%PYTHONの%' は、内部または外部コマンドとして認識されない\ 操作可能なプログラムまたはバッチファイル。 C:\ Users \ Matt Cashatt> –

+0

フォーマットについてごめんね。 –

+1

また、 'D'ドライブはあなたが不思議に思っている場合のためにPythonを持っています。あなたの助けをもう一度ありがとう。 –

4

私は同じ問題を抱えていて、これらの回答のどれも役に立たなかった。私の場合、PYTHON変数が正しく設定されていました。しかし、Pythonのインストールが深すぎる、つまりパスが長すぎます。だから、私は次のようでした:

    Cに
  1. 再インストールのpython:\パイソン
  2. 設定した環境変数PYTHON Cに:\のpythonの\ python.exe

そして、それはそれです!

3

TL; DRは関係なく、私はいつもこのエラーを得た

D:\app\Python27\python.exe
として私のpython 2.7がインストールされていた

名python2.7.exeであなたのpython.exeのコピーやエイリアスを作成していないI方法セット(および検証)PythonのENV変数:

 
gyp ERR! stack Error: Can't find Python executable "python2.7", you can set the PYTHON env variable. 
gyp ERR! stack  at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:103:14) 

この理由は、ノードGYPのconfigure.jsでPythonの実行が解決したことのように:

var python = gyp.opts.python || process.env.PYTHON || 'python'

そして、それはgyp.opts.pythonは、このようにprocess.env.PYTHONをオーバーライド値 'python2.7' を持っていたことが判明しました。

私は名前ノード-GYPが探していたとpython.exe実行ファイルのエイリアスを作成することで、これを解決:

D:\app\Python27>mklink python2.7.exe python.exe

をあなたはこの操作のために管理者権限が必要です。ここで

0

が正しいコマンドです:パス=%パス%に設定; C:\ Python34 [Pythonインストールの正しいパスで置き換え]

私は同じ問題を抱えていたと私はちょうどそのようにこれを解決しました。

これは揮発性の設定であり、現在のcmdセッションでのみ動作し、(明らかに)npm installを実行する前にパスを設定する必要があります。

こちらがお役に立てば幸いです。

0

gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT HON env variable.

再インストールする必要はありませんが、この例外はnode-gypスクリプトを実行して再構築を試みます。それは私がやった私の場合のように、十分なセットアップ環境変数です:

SET PYTHON=C:\work\_env\Python27\python.exe 
0

あなたはCygwinの上でこれを使用しようとしている場合は、あなたがthis答えの指示に従ってくださいする必要があります。 (これは、Cygwinは、Windowsのシンボリックリンクをどのように扱うかの問題です。)これらの

4

つおよび/または複数のに役立つはずです:

  1. をごPATH変数にC:\Python27\を追加
    (あなたはPythonがこのディレクトリにインストールされている考慮して)設定方法PATH env変数:http://www.computerhope.com/issues/ch000549.htm
    変数を設定した後、コンソールまたはWindowsを再起動します。 (「環境変数」)は、上記と同じセクションで

  2. 、名前PYTHONと値C:\Python27\python.exe
    で新しい変数を追加し、変数を設定した後、あなたのコンソールおよび/またはWindowsを再起動し 。

  3. 管理モードのWindowsコマンドライン(cmdを開きます。 Pythonインストール・パスに
    変更ディレクトリ:mklink python2.7.exe python.exe

ベースnode-gypを実行するために、あなたはをから3.xはPython 2.xのを持っていないはずですことに注意してください:cd C:\Python27
一部のインストールに必要なシンボリックリンクを作成しますインストール!以下

テキストは、Unixについて述べているが、Windows版もPythonの2.xのを必要とします。

You can install with npm: 

$ npm install -g node-gyp 
You will also need to install: 

On Unix: 
python (v2.7 recommended, v3.x.x is not supported) 
make 
A proper C/C++ compiler toolchain, like GCC 

また、この記事では、役立つことがあります。https://github.com/nodejs/node-gyp#installation

230

をすべて一緒にインストールのpythonを持っていない場合ノード-GYPのの依存性を、単純に実行します。

npm install --global --production windows-build-tools 
をして、パッケージをインストールするには:

0123を
npm install --global node-gyp 

一度インストールすると、node-gypの依存関係はすべてダウンロードされますが、依然として環境変数が必要です。それは、うめき声​​先に行くと、あなた(ユーザー)を作成していない場合

C:\Users\ben\.windows-build-tools\python27\python.exe 

Note - it uses python 2.7 not 3.x as it is not supported

環境変数:

setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe" 

再起動cmdを検証Pythonのは、確かに正しいフォルダに発見されました変数が存在することを確認して、

最後に再適用npm install <module>

+0

私はいくつかのパーミッションエラーがありましたが、 C:\ Users \ [私] \。windows-build-tools \ python.msiから手動でPythonをインストールすることができました。 インストールには、パスに追加するオプションがあります。 (cmd/PSを再起動すると) –

+0

エラーdhキーが小さすぎる:openssk \ ssl \ s3_clnt、c:3641 – user1428716

+7

windows-build-toolsをインストールする必要があるPowerShellはWindows 10でAdminとして実行されます。これはsetxコマンド'setx PYTHON $ env:USERPROFILE \ .windows-build-tools \ python27 \ python.exe'になります。 – Bae

1

なぜpythonインストーラをダウンロードしないのですか?here

は、Windowsビルド・ツールのインストール(これは15〜20分かかることがあります):あなたは

0

以下は、管理者としてコマンドラインから私のために働いたパスのインストールを確認するとき、それはあなたのために仕事をする

setx PYTHON "%USERPROFILE%\.windows-build-tools\python27\python.exe" 

インストールノード-GYP:

npm --add-python-to-path='true' --debug install --global windows-build-tools 

環境変数を更新/追加

npm install --global node-gyp 

exeファイルの名前をPythonからPython2.7に変更しました。 ) 1 "管理者" としてコマンドプロンプトを実行します。

C:\Users\username\.windows-build-tools\python27\Python2.7 

npm install module_name --save

0

は、この問題を解決するためにいくつかの解決策があります。

最初のソリューションは、あなたの問題はこれを試してみてください解決しない場合:

2)管理者は、次のコード行を貼り付け、Enterキーを押してコマンドプロンプトを開きます

npm install --global --production windows-build-tools 
関連する問題