Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] NPM doesn't allow me to 'npm i' on even slightly weak network connections #4430

Open
2 tasks done
okirpane opened this issue Feb 17, 2022 · 2 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@okirpane
Copy link

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

When I run npm i on my computer (Macbook Pro 2020) with a 5G internet connection that drops packages every now and then, the command hangs at larger packages.
Basically:

  • I run npm i
  • It downloads a few packages
  • It reaches a package that is slightly big
  • Then just... stops.
  • I have to then CTRL+C in the terminal to quit the process and find a more consistent network connection.

Expected Behavior

I would expect my package manager to at least work when my connection wavers a little. The fact that NPM just fails completely is dissapointing.

Steps To Reproduce

  1. Connect to a slightly unstable network connection
  2. Start a project with some node_modules
  3. Run npm i
  4. Observe that it hangs when it reaches a large package.

Environment

  • npm: npm 8.3.0
  • Node.js: Node.js v16.11.0
  • OS Name: MacOS Monterey 12.2.1
  • System Model Name: Macbook Pro 2020
  • npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc

prefix = "/opt/homebrew" 

; "project" config from /Users/okirp/Desktop/ojasvin/.npmrc

engine-strict = true 

; node bin location = /opt/homebrew/Cellar/node/16.11.0/bin/node
; cwd = /Users/okirp/Desktop/ojasvin
; HOME = /Users/okirp
; Run `npm config ls -l` to show all defaults.
@okirpane okirpane added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Feb 17, 2022
@nlf
Copy link
Contributor

nlf commented Mar 7, 2022

it's likely what's happening here is a request is timing out, so we're retrying it. by default we'll retry the same package 2 times after the initial failure, so i would expect to see what appears to be npm hanging for the time it takes 3 requests to timeout which is ~15 minutes by default. if you npm i --fetch-timeout=60000 it'll reduce the overall failure time to ~3 minutes, though based on the information provided all that's really going to do is get you to an error quicker.

i'm curious, how large of a package are you seeing this failure with? if you download the package tarball outside of npm (i.e. curl or wget) how long does it take to transfer?

@spotlesscoder
Copy link

this is extremely annoying.
Happened to me in train again yesterday
2 retries as default is not enough. Sometimes you're offline on train for 5 minutes or more
The default retries should be like 10 or so
Also, large packages should be fetched in chunks and the chunks should be retried individually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

3 participants