Skip to content

[BUG] npm install via custom registry with path prefix does not work anymore #8253

@zekroTJA

Description

@zekroTJA

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

We are using a custom npm registry which is accessible via an URL path prefix like https://example.com/npm.

After upgrading to the latest 11.3 version of npm, we noticed, that the installation process fails with the following error.

$ npm install react
npm error code E404
npm error 404 Not Found - GET https://<redacted>/react/-/react-19.1.0.tgz
npm error 404
npm error 404  'react@https://<redacted>/react/-/react-19.1.0.tgz' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.

In the logs of our registry service, we notice the path prefix /npm is missing from the package archive request.

2025-04-24T14:08:34+02:00 INFO     WebServer  GET /npm/react status=200 ttfb=0s took="343.724ms" written=2787887 rid="d052jgmr54qdharghlng"
2025-04-24T14:08:34+02:00 INFO     WebServer  GET /react/-/react-19.1.0.tgz status=404 ttfb=0s took="0.051ms" written=44 rid="d052jgmr54qdharghlo0"

When using version 10.9.2 of npm, the package archive is correctly requested with the path prefix.

2025-04-24T16:23:51+02:00 INFO     WebServer  GET /npm/react status=200 ttfb=0s took="370.604ms" written=2787887 rid="d054itur54qdhargj0lg"
2025-04-24T16:23:51+02:00 INFO     WebServer  GET /npm/react/-/react-19.1.0.tgz status=200 ttfb=0s took="0.229ms" written=24066 rid="d054itur54qdhargj0mg"

Expected Behavior

When the registry URL contains a path prefix, it should be used for downloading the package as same as in version 10.

Steps To Reproduce

Environment

  • npm: 11.3.0
  • Node.js: v22.14
  • OS Name: Fedora Linux
  • npm config:
; "user" config from /home/rhoffmann/.npmrc

@ranna-go:registry = "https://npm.pkg.github.com/"
//npm.pkg.github.com/:_authToken = (protected)

; "project" config from /home/rhoffmann/dev/test/.npmrc

registry = "https://<redacted>/npm"

; node bin location = /home/rhoffmann/.local/share/fnm/node-versions/v22.14.0/installation/bin/node
; node version = v22.14.0
; npm local prefix = /home/rhoffmann/dev/test
; npm version = 11.3.0
; cwd = /home/rhoffmann/dev/test
; HOME = /home/rhoffmann

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions