【问题标题】:Accessing GitHub using NPM on Sonatype Nexus在 Sonatype Nexus 上使用 NPM 访问 GitHub
【发布时间】:2015-02-06 12:49:48
【问题描述】:

我们目前正在使用 Nexus 2.10,并已成功将其用作 npm 的存储库。

通过此代理/镜像在本地构建工作正常,但是当尝试在 Bamboo(无法访问 Internet)上运行 npm install 时,它会失败,因为某些依赖项试图到达 GitHub 下载某些东西,但失败了。

error   06-feb-2015 13:29:29    npm http 200 https://nexus.shdir.no/content/groups/npm-all/mkdirp/-/mkdirp-0.3.0.tgz
error   06-feb-2015 13:29:30    npm http GET https://nexus.shdir.no/content/groups/npm-all/formidable
error   06-feb-2015 13:29:30    npm http 200 https://nexus.shdir.no/content/groups/npm-all/formidable
error   06-feb-2015 13:29:45    npm ERR! fetch failed https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz
error   06-feb-2015 13:29:55    npm http GET https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz
error   06-feb-2015 13:30:16    npm ERR! fetch failed https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz
error   06-feb-2015 13:31:16    npm http GET https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz
error   06-feb-2015 13:31:37    npm ERR! fetch failed https://github.com/rase-/node-XMLHttpRequest/archive/a6b6f2.tar.gz
error   06-feb-2015 13:31:38    npm ERR! network connect ETIMEDOUT
error   06-feb-2015 13:31:38    npm ERR! network This is most likely not a problem with npm itself
error   06-feb-2015 13:31:38    npm ERR! network and is related to network connectivity.
error   06-feb-2015 13:31:38    npm ERR! network In most cases you are behind a proxy or have bad network settings.
error   06-feb-2015 13:31:38    npm ERR! network 
error   06-feb-2015 13:31:38    npm ERR! network If you are behind a proxy, please make sure that the
error   06-feb-2015 13:31:38    npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
error   06-feb-2015 13:31:38    
error   06-feb-2015 13:31:38    npm ERR! System Windows_NT 6.1.7601
error   06-feb-2015 13:31:38    npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
error   06-feb-2015 13:31:38    npm ERR! cwd E:\bamboo\UTV-FP-JOB1\code
error   06-feb-2015 13:31:38    npm ERR! node -v v0.10.17
error   06-feb-2015 13:31:38    npm ERR! npm -v 1.3.8
error   06-feb-2015 13:31:38    npm ERR! syscall connect
error   06-feb-2015 13:31:38    npm ERR! code ETIMEDOUT
error   06-feb-2015 13:31:38    npm ERR! errno ETIMEDOUT

我将如何解决这个问题?我是否必须将 github/bitbucket 中的每个 repo 添加到 Nexus?

【问题讨论】:

    标签: github npm nexus


    【解决方案1】:

    我们通过手动下载二进制文件并将它们添加到我们的 Apache 服务器解决了这个问题。更新依赖项时不会很有趣,但应该不会太糟糕。只有 3 个文件。

    如果有人知道的话,我很乐意使用更好的解决方案。

    【讨论】:

      【解决方案2】:

      您必须使 Nexus 可用于您的 Bamboo 服务器并在那里配置 npm,就像您在工作站上所做的那样。根据可能需要不同步骤的网络拓扑结构,取决于安装 Bamboo 和 Nexus 的位置。

      理想情况下,您的存储库管理器和 CI 服务器位于同一位置,并且彼此之间具有高性能连接。这允许快速下载代理包以及快速部署。

      例如,您可以让您的 Nexus 在公共互联网上可用并将其锁定以仅允许经过身份验证的访问,然后像在 Bamboo 中那样使用它。

      【讨论】:

      • Nexus 可用,位于 npm 存储库的软件包可以从 Bamboo 访问。它是对 Github 的直接 http 调用导致内爆。是否可以说例如所有对 github 和 bitbucket 的 https 请求都可以通过吗?完全访问网络可能是不可行的,尽管我还不能询问它。在本地,我们可以完全访问互联网。
      猜你喜欢
      • 2014-07-05
      • 1970-01-01
      • 2015-11-30
      • 2021-04-11
      • 2019-06-19
      • 2018-02-11
      • 2023-04-07
      • 2014-05-20
      • 2017-07-04
      相关资源
      最近更新 更多