npm / npm/cli

[BUG] npm install fails with ECONNRESET when metainfo is big

Open
#5,166 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
Current Behavior

If package metainfo, for some reasons, is superbig (e.g. 70 mb), npm install often fails with ECONNRESET. Argument --prefer-offline does not help.

yarn works just fine, 5 out of 5 times it ends with success. npm fails 5 out of 5.

Also, yarn 1 finished after 1-2 mins, without yarn.lock file (repo itself uses npm, so there is no yarn.lock and there is package-lock.json), and npm fails after 15-20 mins.

Expected Behavior

Same as yarn 1 – dont fail if there are problems with metainfo. Im not sure why yarn 1 is better here, but could make guess: 1) it retries failed requests many times 2) it does not request metainfo.

Steps To Reproduce
  1. just repo with deps, which has superbig metainfo (e.g. webpack, playwright or @typescript-eslint/eslint-plugin) and not very good network
  2. Run 'npm install'
  3. see
npm i --prefer-offline
npm WARN deprecated @***/cache-loader@4.2.9: Not usefull anymore in webpack 5 with its own filesystem cache
npm WARN deprecated viz.js@2.1.2: no longer supported
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://***/repository/npm-all/@typescript-eslint%2feslint-plugin: aborted
npm ERR! network This is a problem 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! A complete log of this run can be found in:
npm ERR!     /Users/d***/.npm/_logs/2022-07-13T12_41_34_019Z-debug-0.log
Environment
  • npm: 8.11.0
  • Node.js: 16.v16.15.1
  • OS Name: mac OS Monterey 12.4
  • System Model Name: -
  • npm config:
; "user" config from /Users/d***/.npmrc

//npm-rnd.***/:_authToken = (protected)
//registry.npmjs.org/:_authToken = (protected)
always-auth = true
email = "d***@***"
init-author-email = "d***@***"
init-author-name = "D K"
; registry = "https://***/repository/npm-all/" ; overridden by project

; "project" config from /Users/d***/Projects/***-forms/.npmrc

_auth = (protected)
ca = [""]
engine-strict = true
legacy-peer-deps = true
registry = "https://***/repository/npm-all/"
strict-ssl = false

; node bin location = /Users/d***/.nvm/versions/node/v16.15.1/bin/node
; node version = v16.15.1
; npm local prefix = /Users/d***/Projects/***-forms
; npm version = 8.11.0
; cwd = /Users/d***/Projects/***-forms
; HOME = /Users/d***
; Run `npm config ls -l` to show all defaults.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names no source files or tests; first reproduce npm i --prefer-offline with a dependency whose metadata is very large, using the listed npm and Node.js environment. Compare the ECONNRESET behavior with Yarn 1, then trace the npm registry/network request path; done means the install completes reliably for the reported case without the connection reset.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.