2015-06-23 19 views
5

Sto costruendo un'immagine da un Dockerfile e la parte in cui I npm installa le dipendenze ha un errore durante la creazione dell'immagine, ma posso eseguire i comandi al di fuori di essa. Non so esattamente da dove provenga questo errore.Can not npm installa le dipendenze quando si costruisce l'immagine della finestra mobile

sto usando boot2docker su Windows e la mia Dockerfile è:

FROM ubuntu:15.04 

RUN apt-get -y update 
RUN apt-get -y install nodejs 
RUN apt-get -y install npm 

COPY /server /src 
COPY /server/package.json /tmp/package.json 

RUN cd /tmp && npm install 

(etc) 

Il messaggio di errore è:

sh:1 node: not found 
npm WARN: This failure might be due to the use of legacy binary "node" 
npm WARN: For further explanations, please read 
/usr/share/doc/nodejs/README.Debian 

npm ERR! [email protected] preinstall: 'node ./lib/preinstall_npmcheck.js' 
npm ERR! Exit status 127 
npm ERR! 
npm ERR! Failed at the [email protected] preinstall script. 
npm ERR! This is most likely a problem iwth the sails package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node ./lib/preinstall_npmcheck.js 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls sails 
npm ERR! There is additional logging output above. 

npm ERR! System Linux 4.0.3-boot2docker 
npm ERR! command "usr/bin/nodejs" "/usr/bin/npm" "install" 

npm ERR! node -v v0.10.25 
npm ERR! npm -v 1.4.21 
npm ERR! code ELIFECYCLE 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /tmp/npm-debug.log 
npm ERR! not ok code 0 
INFO[0633] THe command [/bin/sh -c cd /tmp && install] returned a non-zero code: 1 

Anche se si dice che è probabilmente un problema con le vele, non ho alcun problema installazione sulla mia macchina. Non riesco ad installarlo quando eseguo l'immagine (ovviamente), e quando provo a eseguire solo l'immagine di Ubuntu: 15.04 e installare npm e Sails, mi viene detto che npm è un command not found.

Sono ancora nuovo su Docker (e su Windows-- non riesco nemmeno a trovare il npm-debug.log), quindi qualsiasi tipo di consiglio aiuta molto.

Grazie!

risposta

6

Si tratta di un problema di installazione nodejs che è stato coperto qui: what are the differences between node.js and node?

breifly, ci sono tre opzioni per risolvere questo: creare un link simbolico da soli, utilizzando NVM, o l'installazione di nodejs-legacy invece di nodejs:

RUN apt-get -y install nodejs-legacy

+0

Fantastico! Grazie mille :) –

Problemi correlati