[BUG] npm@10 refuses to install packages from GitHub package registry
Problem
Is there an existing issue for this? - [X] I have searched the existing issues This issue exists in the latest npm version - [X] I am using the latest npm Current Behavior npm@10 is not installing packages from a private GitHub Enterprise Server registry. It fails with a 403 forbidden error when trying to fetch the package. Previous versions of npm do not encounter this issue. Expected Behavior I should be able to install packages from a private registry when my `.npmrc` is configured properly. Steps To Reproduce Remove ~/.npm to ensure we're not pulling from cache [code block] Configure `.npmrc` to use a private registry (in this case, I am using GitHub Enterprise Server 3.9.3) [code block] Install a package from the private registry: [code block] Debug log: 2023-11-25T00_29_42_285Z-debug-0.log When using npm v9, this error does not occur. For example, with Node 18/npm 9: [code block] Using npm v10 with node 18 fails with the same 403. Use npm v9 with node 21 works. [code block] This seems to indicate that something has changed with npm 10 with how it handles private registries (or at least with GitHub's registry). Environment - npm: 10.2.4 - Node.js: 20, 21 - OS Name: Linux (RHEL 8) - npm config: [code block]
Error Output
error when trying to fetch the package. Previous versions of npm do not encounter this issue.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: [BUG] npm@10 refuses to install packages from GitHub package registry
I have the same problem, but it does not seem to be bound to GitHub package registries. I am using Azure DevOps artifact streams and get a 403 error when using npm 10 in combination with an HTTP proxy. Downgrading to npm 9 or removing the proxy "solves" the issue. Edit: I could narrow it down to version `10.2.x`. The previous version `10.1.0` is not affected by this problem.
Trust Score
3 verifications
- 1
I have the same problem, but it does not seem to be bound to GitHub package regi
I have the same problem, but it does not seem to be bound to GitHub package registries. I am using Azure DevOps artifact streams and get a 403 error when using npm 10 in combination with an HTTP proxy.
- 2
Downgrading to npm 9 or removing the proxy "solves" the issue.
Downgrading to npm 9 or removing the proxy "solves" the issue.
- 3
Edit: I could narrow it down to version `10.2.x`. The previous version `10.1.0`
Edit: I could narrow it down to version `10.2.x`. The previous version `10.1.0` is not affected by this problem.
Validation
Resolved in npm/cli GitHub issue #7024. Community reactions: 2 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep