Docker容器无法安装NPM软件包

时间:2018-06-05 14:16:41

标签: node.js docker npm npm-registry

在我的docker文件中,当涉及到安装npm软件包时,我收到错误:

npm WARN athena@1.0.0 No description
npm WARN athena@1.0.0 No repository field.

npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-06-05T13_33_53_797Z-debug.log

我的Dockerfile是:

FROM node:10.3-alpine
COPY . /app
WORKDIR /app
RUN npm install
EXPOSE 8080
ENTRYPOINT [ "npm run start:dev" ]

在线搜索I came across this link on github,然而,按照Jkugyiya的帖子添加说明并没有解决。我想知道我是否正确地将该行添加到我的/etc/host文件中。

我的问题是如何让Docker在图像中安装NPM包。

由于

编辑: 根据@ Capricorn的请求,开发环境的详细信息如下: Ubuntu 18.04 Docker版本17.12

EDIT2: 正在运行ping registry.npmjs.org会产生类似于下面的无穷无尽的消息。虽然所有数据包都是传输的,但是但是,收到时间延迟:

64 bytes from registry.npmjs.org (151.101.72.162): icmp_seq=3 ttl=53 time=333 ms
64 bytes from registry.npmjs.org (151.101.72.162): icmp_seq=4 ttl=53 time=273 ms
64 bytes from registry.npmjs.org (151.101.72.162): icmp_seq=5 ttl=53 time=317 ms
64 bytes from registry.npmjs.org (151.101.72.162): icmp_seq=6 ttl=53 time=253 ms
64 bytes from registry.npmjs.org (151.101.72.162): icmp_seq=7 ttl=53 time=301 ms
64 bytes from registry.npmjs.org (151.101.72.162): icmp_seq=8 ttl=53 time=337 ms
...

0 个答案:

没有答案
相关问题