2014-05-09 6 views
14

quando installo iconv con npm ottenuto il seguente errore:Non riesci a trovare Python eseguibile "python"

[email protected] install /root/Dropbox/nodeApps/nodeApp/node_modules/iconv node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable. 
gyp ERR! stack  at failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14) 
gyp ERR! stack  at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11 
gyp ERR! stack  at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:25) 
gyp ERR! stack  at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29) 
gyp ERR! stack  at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16 
gyp ERR! stack  at Object.oncomplete (fs.js:107:15) 
gyp ERR! System Linux 3.8.0-19-generic 
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /root/Dropbox/nodeApps/nodeApp/node_modules/iconv 
gyp ERR! node -v v0.10.28 
gyp ERR! node-gyp -v v0.13.0 
gyp ERR! not ok 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script. 
npm ERR! This is most likely a problem with the iconv 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 iconv 
npm ERR! There is likely additional logging output above. 
npm ERR! System Linux 3.8.0-19-generic 
npm ERR! command "node" "/usr/local/bin/npm" "i" 
npm ERR! cwd /root/Dropbox/nodeApps/nodeApp 
npm ERR! node -v v0.10.28 
npm ERR! npm -v 1.4.10 
npm ERR! code ELIFECYCLE 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /root/Dropbox/nodeApps/nodeApp/npm-debug.log 
npm ERR! not ok code 0 

anche se ho installato Python e può essere eseguito da console:

# python 
Python 2.7.3 (default, May 9 2014, 12:18:32) 
[GCC 4.8.2] on linux2 

e impostare PATH in ~/.bashrc:

export PYTHONPATH=$PYTHONPATH:/Python-2.7.3 
export PATH=$PATH:/Python-2.7.3 

e fatto . ~/.bashrc

+0

il problema è dovuto al fatto che '~/.bashrc' non è stato caricato sull'accesso ssh. Ho messo i permessi di 'PATH' a' ~/.bash_profile' ed è ok –

+0

Ho avuto il parametro PYTHON var in ~/.zshrc ma ho continuato a ricevere l'errore dopo aver riavviato iTerm, quindi ho finito con questo trucco simlink: $ quale python /usr/bin/python $ sudo ln -s/usr/bin/python/usr/local/bin/python – kwcto

risposta

8

nella sessione bash dove siete in grado di basta digitare python e ottenere una risposta valida, digitare which python e annotare il percorso percorso completo del python binario. Prendi quel luogo e inseriscilo nelle tue variabili di ambiente PYTHONPATH e PATH, tranne senza il python alla fine.

Per esempio, which python mi dà:

/usr/local/bin/python 

così avrei scritto:

export PYTHONPATH=$PYTHONPATH:/usr/local/bin 
export PATH=$PATH:/usr/local/bin 

nel mio ~/.bashrc.

+0

'-bash::/usr/bin: nessun file o directory simile. – Green

1

il problema era a causa di ~/.bashrc non è stato caricato su accesso ssh. Ho messo PATH VAR di ~/.bash_profile ed è ok

22

Per chiunque incontrare questo problema su Ubuntu 16.04 ...
node-gyp non possono usare Python 3.5.x che sembra l'essere il che viene fornito di default con 16.04. Ho letto da qualche parte che la 16.04 doveva essere fornita con Python2 ma non riesco a trovarla sulla mia installazione.

ho risolto il problema di cui sopra da:

apt-get update  
apt-get install python2.7  
ln -s /usr/bin/python2.7 /usr/bin/python 

Ora, quando node-gyp va in cerca di python colpirà la vostra Python2.7 installare e caricare correttamente.