0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AzurePipelines: npm install で、npm error code ECONNRESET が出たときの対処法?

Posted at

背景

Pipelines で e2e テスト実装した際に、npm install でたまにエラーになることがあった。
その際の対処法の記録

実際のエラー

Acquire の 設定漏れ?とか思っちゃうようなエラーだけど、
Resubmit を何回かすると解消しちゃう。

Pipelines の VM としては特に設定しなくても動くけど、ごくまれに失敗する。
ってことで、設定ではない、と思うんだけど、よくわからず・・

error
npm error code ECONNRESET
npm error errno ECONNRESET
npm error network Invalid response body while trying to fetch https://registry.npmjs.org/@fluentui%2freact-popover: aborted
npm error network This is a problem related to network connectivity.
npm error network In most cases you are behind a proxy or have bad network settings.
npm error network
npm error network If you are behind a proxy, please make sure that the
npm error network 'proxy' config is set properly.  See: 'npm help config'

結論

bash で npm install をするのではなく、
task として用意されている npm を使う

script でやってた方法
- script: |
  cd ./app/frontend
  npm install
  npm run build
   displayName: 'build frontend'
専用 task を利用する
- task: Npm@1
  inputs:
    command: 'install'
    workingDir: '$(System.DefaultWorkingDirectory)/app/frontend'
    verbose: true
  displayName: 'npm install'

- task: Npm@1
  inputs:
    command: 'custom'
    workingDir: '$(System.DefaultWorkingDirectory)/app/frontend'
    customCommand: 'run build'
  displayName: 'npm run build'

エラー記録

npm error code ENOENT は、workingDir が未設定

フォルダ未設定エラー
npm error code ENOENT
npm error syscall open
npm error path /home/vsts/work/1/s/package.json
npm error errno -2
npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/home/vsts/work/1/s/package.json'
npm error enoent This is related to npm not being able to find a file.
npm error enoent

あとがき

現状、これで再発してない・・けど、どうなんでしょうね・・

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?