npm安装错误说'错误:getaddrinfo ENOTFOUND npm.lab.myorg.com'

在标记我的问题重复之前..我尝试了一切,我可以find谷歌

故事:我们正在使用npm企业专用回购。 Docker + Vagrant用于构buildEnv安装程序。 安装脚本包含npm install引用来自私有npm install的软件包。 和NPM安装失败,以下错误

 npm http request GET https://npm.lab.myorg.com/passport-http npm info attempt registry request try #3 at 4:27:26 PM npm http request GET https://npm.lab.myorg.com/verror npm ERR! Linux 3.13.0-24-generic npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v5.6.0 npm ERR! npm v3.6.0 npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! network getaddrinfo ENOTFOUND npm.lab.myorg.com npm.lab.myorg.com:443 npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! Please include the following file with any support request: npm ERR! /usr/src/app/npm-debug.log 

我已经尝试了在网上build议的一切

  1. 尝试重新启动DNS。
  2. 从IT部门发现,如果有代理,没有。 所以确保npm config proxy是空的
  3. 我检查了连接到npm.lab.myorg.com:443和它的好

    vagrant@dockerhost:~/git/ curl -Is https://npm.lab.myorg.com/ HTTP/1.1 200 OK Server: nginx/1.4.6 (Ubuntu) Date: Sun, 16 Oct 2016 16:26:40 GMT Content-Type: text/html; charset=utf-8 Content-Length: 36342 Connection: keep-alive X-Powered-By: Sinopia/1.4.0 X-Frame-Options: deny ETag: "180fec4dfa875dd07ebf5f43887ca234" Vary: Accept-Encoding X-Status-Cat: http://flic.kr/p/aVuVsF

更新1; 在Dockerfile插入步骤RUN curl -I -vvvv https://npm.lab.myorg.com/ ,从Dockerfile容器内部curl失败

这是输出

 Step 5 : RUN curl -I -vvvv https://npm.lab.myorg.com/ ---> Running in a677c4429ea5 * Hostname was NOT found in DNS cache % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Could not resolve host: npm.lab.myorg.com * Closing connection 0 curl: (6) Could not resolve host: npm.lab.myorg.com ERROR: Service '******' failed to build: The command '/bin/sh -c curl -I -vvvv https://npm.lab.myorg.com/' returned a non-zero code: 6 

当从terminal运行时,同样的curl工作都很好。

更新2:下面的docker文件内容

 FROM tools.lab.myorg.com:5000/myorg/node:0.10.40.3 LABEL description="blahhblah API" \ version=1.0 ENV WORKDIR=/usr/src/app WORKDIR $WORKDIR RUN curl -I -vvvv https://www.google.co.in/ RUN mkdir -p $WORKDIR/script \ && npm install -g privatePackage1 && npm install -g privatePackage2 # COPY ./package.json $WORKDIR # COPY ./script/ $WORKDIR/script/ # RUN ./script/bootstrap COPY . $WORKDIR CMD ["script/server"] 

尝试运行curl -I -vvvv https://npm.lab.myorg.com/直接在您的安装脚本中的npm install命令之前(我认为这是从Dockerfile运行命令在Docker容器上运行?)。

这应该打印出一些debugging信息来显示Docker容器是否可以访问你的私有仓库。