2016-06-29 18 views
0

Dockerfile läuft:Seltsame Fehler beim NPM installieren auf alpinen Linux

FROM iron/node 
RUN apk add --update bash && rm -rf /var/cache/apk/* 
RUN apk add --update curl && rm -rf /var/cache/apk/* 
WORKDIR /usr/src/app 
COPY . /usr/src/app 
RUN npm install 
CMD [ "node", "index.js" ] 

Docker build log:

Sending build context to Docker daemon 198.2 MB 
Step 1 : FROM iron/node 
---> 9ca501065d18 
Step 2 : RUN apk add --update bash && rm -rf /var/cache/apk/* 
---> Using cache 
---> 0a03d023f33e 
Step 3 : RUN apk add --update curl && rm -rf /var/cache/apk/* 
---> Using cache 
---> 3e0176dae102 
Step 4 : WORKDIR /usr/src/app 
---> Using cache 
---> 3f9d925bd76c 
Step 5 : COPY . /usr/src/app 
---> 0c2c195505dd 
Removing intermediate container de7cb9edede2 
Step 6 : RUN npm install 
---> Running in d7549ec2707d 
Error relocating /usr/bin/node: uv_os_free_passwd: symbol not found 
Error relocating /usr/bin/node: uv_os_get_passwd: symbol not found 
The command '/bin/sh -c npm install' returned a non-zero code: 127 

Was ist los? Was bedeuten diese Fehler ?:

Error relocating /usr/bin/node: uv_os_free_passwd: symbol not found 
Error relocating /usr/bin/node: uv_os_get_passwd: symbol not found 

Wie behebt man das?

Antwort

1

Nicht sicher, was mit dem los ist. Ich habe offensichtlich nicht Ihre App, aber ich habe versucht, eine npm-Installation eines öffentlichen Moduls (z. B. newman) und ich traf den gleichen Fehler. Mit Blick auf die dockerhub page für das Bild, fand ich die Dockerfile - die scheint, npm zu deinstallieren. In der Tat, als ich diese dockerfile direkt ausgeführt habe, gab es keinen npm - also bin ich mir nicht sicher, wie das öffentliche Image es immer noch hat, es sei denn, ihr Build-Prozess ist im Moment ein bisschen kaputt.

Als Randbemerkung, es ist ein wenig ineffizient, dies zu tun:

RUN apk add --update bash && rm -rf /var/cache/apk/* 
RUN apk add --update curl && rm -rf /var/cache/apk/* 

Stattdessen Sie bash und curl bei gleichzeitig installieren sollte:

RUN apk add --update bash curl && rm -rf /var/cache/apk/* 

Kombination all diese Schritte (dh mit der dockerfile direkt, und die kombination apk-installationen), und nicht deinstallieren npm gibt mir:

Das schien gut zu funktionieren.