You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] replace-registry-host doesn't support when two different registries have paths #6110
I have a setup where there may be different registries for example https://myRegistry.com/a/b/package/-/package-1.1.1.tgz
and https://myRegistry2.com/a/b/package/-/package-1.1.1.tgz
the first registry would return for the tarball https://myRegistry.com/a/b/package/-/package-1.1.1.tgz
and if we have replace-registry-host enabled it would replace it like this: https://myRegistry2.com/a/b/a/b/package/-/package-1.1.1.tgz
This seems like a strange example, but the use case is myRegistry may be a public facing uri but we would want a way to hit the registries through another uri depending on how the environment is configured (for example if we can not hit the public uri from a protected environment)
Expected Behavior
I would expect replace-registry-host to be able to specify the path that should be replaced instead of just a registry, for example
--replaceRegistryHost=https://myRegistry2.com/a/b/
Steps To Reproduce
The registry can return a tarball that contains a different hostname than the registry
2.
This issue (feature request) is still persistent today. Most third party caches append a URL path prefix for their registry setting and you'll still get errors switching, since the paths at concatenated presently if you use replace-registry-host=always or the bare hostname.
ie:
npm error code E404
npm error 404 Not Found - GET https://new-repo.example.com/api/b/repository/a/my-package/-/my-package-4.0.4.tgz
The PR above resolves this by parsing for paths too. Moving to a new cache looks like this:
This allows you to use npm ci without needing to manually edit or delete the lock file, ensuring unpinned module versions don't change simple due to switching caches.
Activity
fix(arborist): only replace hostname for resolved URL (#8185)
feat(arborist): extend replace-registry-host to URL prefix matching (n…
u2mejc commentedon Jun 26, 2026
This issue (feature request) is still persistent today. Most third party caches append a URL path prefix for their
registrysetting and you'll still get errors switching, since the paths at concatenated presently if you usereplace-registry-host=alwaysor the bare hostname.ie:
The PR above resolves this by parsing for paths too. Moving to a new cache looks like this:
This allows you to use
npm ciwithout needing to manually edit or delete the lock file, ensuring unpinned module versions don't change simple due to switching caches.feat(arborist): extend replace-registry-host with URL prefix matching (…
feat(arborist): extend replace-registry-host with URL prefix matching (…
⬆️ Update dependency npm to v11.21.0
⬆️ Update dependency npm to v11.21.1