Docker npm getaddrinfo EAI_AGAIN registry.npmjs.org registry.npmjs.org:443
问题描述使用docker使用npm构建镜像的时候报错如下:npm ERR! code EAI_AGAINnpm ERR! errno EAI_AGAINnpm ERR! request to https://registry.npmjs.org/grunt failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org regist...
·
问题描述
使用docker使用npm
构建镜像的时候报错如下:
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/grunt 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-08-21T09_16_04_593Z-debug.log
解决过程
- Dockerfile中加入
RUN npm install -g cnpm --registry=http://r.cnpmjs.org
,后面的npm
全改为cnpm
。结果失败了,依然报错。 - 在stackoverflow找到同样问题,
sudo service docker restart
,成功。
参考:https://stackoverflow.com/questions/45705555/error-installing-react-native-request-to-https-registry-npmjs-org-yallist-fai
后续问题
Error making request.
Error: connect ETIMEDOUT 54.231.120.211:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1161:14)
Please report this full log at https://github.com/Medium/phantomjs
显然超时了,再把解决过程1的操作加上,终于成功了。
更多推荐
已为社区贡献4条内容
所有评论(0)