簡體   English   中英

NPM 安裝總是無法隨機獲取 Docker 容器中的 NPM 注冊表

[英]NPM install always fails to fetch NPM registry in Docker container at random times

我們已經在 Node.js Web 應用程序上設置了持續集成/部署。 問題是,當管道在 CI 服務器 (GitLab CI) 上的 docker 容器中運行測試時,npm install 會隨機失敗。 容器使用 node v5.0.0 和 npm v3.3.6。 NPM 安裝的輸出是:

npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info attempt registry request try #3 at 4:39:19 PM
npm http fetch GET https://registry.npmjs.org/commander/-/commander-2.8.1.tgz
npm info attempt registry request try #3 at 4:39:19 PM
npm http fetch GET https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz
npm ERR! fetch failed https://registry.npmjs.org/commander/-/commander-2.8.1.tgz
npm WARN retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! fetch failed https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz
npm WARN retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info retry fetch attempt 3 at 4:40:27 PM
npm info attempt registry request try #1 at 4:40:27 PM
npm http fetch GET https://registry.npmjs.org/commander/-/commander-2.8.1.tgz
npm info retry fetch attempt 3 at 4:40:27 PM
npm info attempt registry request try #1 at 4:40:27 PM
npm http fetch GET https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info attempt registry request try #2 at 4:40:45 PM
npm http fetch GET https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz
npm info attempt registry request try #2 at 4:40:45 PM
npm http fetch GET https://registry.npmjs.org/commander/-/commander-2.8.1.tgz
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info retry will retry, error on last attempt: Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm info attempt registry request try #3 at 4:41:53 PM
npm http fetch GET https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz
npm info attempt registry request try #3 at 4:41:53 PM
npm http fetch GET https://registry.npmjs.org/commander/-/commander-2.8.1.tgz
npm ERR! fetch failed https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz
npm ERR! fetch failed https://registry.npmjs.org/commander/-/commander-2.8.1.tgz
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! syscall getaddrinfo

npm ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org: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 無法獲取 3 次中的 2 次,所以這似乎是一個網絡問題,但是 CI 服務器正在 Compute Engine 上運行(我相信 Google 和 NPM 注冊表連接......)。 所以我只是嘗試重新啟動我的 Docker 服務,但它也不起作用。

有什么想法嗎? 提前致謝!

編輯:今天(2016 年 10 月 21 日)發生了大規模的 DNS 中斷,這可能是問題的根源嗎? 它還可以解釋為什么其他項目的其他構建在不久之后的部署步驟中失敗了。 https://www.wired.com/2016/10/internet-outage-ddos-dns-dyn/

事實證明,今天發生了大規模的 DNS 中斷,導致我的構建失敗。 https://www.wired.com/2016/10/internet-outage-ddos-dns-dyn/

檢查 VPN 是否開啟。 在大多數情況下,VPN 會導致此問題。 斷開與 VPN 的連接,然后再試一次,它會起作用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM