Skip to content

[BUG] npm install hangs for several minutes while downloading tarballs from registry that redirects package downloads to s3 links #6517

@jonathanwehner

Description

@jonathanwehner

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 using a private npm registry, such as Artifactory, the registry may redirect clients to a pre-signed S3 download link when attempting to download a package. During the install process, the progress bar appears to hang for several minutes at the end. Without the progress bar, install times are as expected. My guess is that it might have something to do with the length of the s3 links (they are much longer than npmjs and regular artifactory links).

The progress bar will stay in this state for several minutes:
Screenshot 2023-06-01 at 9 35 18 AM

For both processes the package download links and dependencies have already been resolved in package-lock.json, node_modules deleted, and cache cleaned:

npm i                                                             ok  02:08:30 PM

added 614 packages, and audited 615 packages in 3m

107 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm i --progress=false                                            ok  02:35:53 PM

added 614 packages, and audited 615 packages in 11s

107 packages are looking for funding
  run `npm fund` for details

Expected Behavior

npm install times are comparable to the time it takes when the progress bar is disabled when using registries such as Artifactory

Steps To Reproduce

  1. Make sure the npm environment is clean by deleting node_modules and running ‘npm cache clean --force’
  2. Configure the npm registry to a registry that redirects package downloads to pre-signed s3 links.
  3. Run npm install

Environment

  • npm: 8.19.3
  • Node.js: 16.16.0
  • OS Name: Ventura 32GB
  • System Model Name: MacBook Pro Apple M1 Max
    Also reproduced on Ubuntu 20.04 with npm 8.19.3
  • npm config:
; "user" config from /Users/xx/.npmrc

//xxxx/artifactory/api/npm/my-npm/:_authToken = (protected)
progress = true
registry = "https://xxxx/artifactory/api/npm/my-npm/"

; node bin location = /Users/xx/.nvm/versions/node/v16.16.0/bin/node
; node version = v16.16.0
; npm local prefix = /Users/xx/packages/my-npm-package
; npm version = 8.19.3
; cwd = /Users/xx/packages/my-npm-package
; HOME = /Users/xx
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions