【问题标题】:npm install -g dredd@stable fails on CircleCI due to npm ERR! code ECONNRESET由于 npm ERR,npm install -g dredd@stable 在 CircleCI 上失败!代码 ECONNRESET
【发布时间】:2017-10-23 01:12:25
【问题描述】:

我在 CircleCI 上有一个项目,它在某个时候开始变红(由于安装 dredd 失败)。目前看来,完全相同的项目(相同的代码,相同的 circle.yml)可能会随机失败或成功。

失败总是在npm install -g dredd@stable阶段,并出现以下错误,该错误会重复多次并最终导致构建失败:

make: Leaving directory /opt/circleci/nodejs/v4.2.6/lib/node_modules/dredd/node_modules/dredd-transactions/node_modules/fury-adapter-apib-parser/node_modules/drafter/node_modules/protagonist/build'
npm ERR! Linux 3.13.0-117-generic
npm ERR! argv "/opt/circleci/nodejs/v4.2.6/bin/node" "/opt/circleci/nodejs/v4.2.6/bin/npm" "install" "-g" "dredd@stable"
npm ERR! node v4.2.6
npm ERR! npm  v2.14.12
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read
npm ERR! network read ECONNRESET
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'

如果我尝试多次重新运行构建,它会在某个时候成功(变为绿色)。然后,dredd 安装会显示如下内容:

make: Leaving directory /opt/circleci/nodejs/v4.2.6/lib/node_modules/dredd/node_modules/dredd-transactions/node_modules/fury-adapter-apib-parser/node_modules/drafter/node_modules/protagonist/build'
/opt/circleci/nodejs/v4.2.6/bin/dredd -> /opt/circleci/nodejs/v4.2.6/lib/node_modules/dredd/bin/dredd
dredd@3.4.5 /opt/circleci/nodejs/v4.2.6/lib/node_modules/dredd
├── caseless@0.12.0
├── clone@2.1.1
├── file@0.2.2

等',基本上成功安装了dredd并继续测试构建。

由于它似乎随机失败,我认为代理与它没有任何关系。这是circle.yml文件供参考:

machine:
  environment:
    APIARY_API_KEY: "123456789ab12cd1234a1a1a123a123a"
  ruby:
    version: 2.3.1
dependencies:
  pre:
    - npm install -g dredd@stable
    - gem install apiaryio
    - pip install dredd_hooks
database:
  override:
    - bundle exec rake db:create db:schema:load db:seed
test:
  pre:
    - apiary fetch --api-name=ourAPIName --output=api-description.yml
    - dredd

欢迎任何帮助。

【问题讨论】:

  • 看起来 npm 注册表存在一些连接问题。我会联系 CircleCI 支持来解决这个问题。
  • 你试过 Yarn 看看是否有助于构建稳定性?

标签: node.js npm circleci econnreset dredd


【解决方案1】:

我遇到了同样的问题。我发现的一个修复方法是将 npm 的注册表更改为使用 HTTP 而不是 HTTPS。在我的 circle.yml 文件中,我从以下位置更改了我的依赖项:

dependencies:
  pre:
    - npm install -g dredd@4.1.1

dependencies:
  pre:
    - npm config set registry http://registry.npmjs.org/
    - npm install -g dredd@4.1.1

【讨论】:

    猜你喜欢
    • 2021-05-15
    • 2016-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-27
    • 1970-01-01
    • 2022-11-04
    相关资源
    最近更新 更多