Unable to publish a package to GitHub Packages with 403 Forbidden despite having package permissions #200969
-
🏷️ Discussion TypeQuestion BodyHello everyone, I'm having trouble publishing a package to GitHub Packages. The package builds successfully, but the publish step consistently fails with a 403 Forbidden error. Environment When I run: npm publish or publish through GitHub Actions, I receive an error similar to: npm ERR! code E403 Despite this, the package cannot be published. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
A 403 Forbidden error when publishing to GitHub Packages is usually related to authentication, permissions, or package configuration rather than npm itself. Here are a few things to verify: Make sure your Personal Access Token includes both write:packages and read:packages. If you're publishing to a private repository, ensure it also has the appropriate repo permissions if required. |
Beta Was this translation helpful? Give feedback.
A 403 Forbidden error when publishing to GitHub Packages is usually related to authentication, permissions, or package configuration rather than npm itself.
Here are a few things to verify:
Make sure your Personal Access Token includes both write:packages and read:packages. If you're publishing to a private repository, ensure it also has the appropriate repo permissions if required.
Confirm that the package scope in package.json matches your GitHub username or organization. For example:
{
"name": "@your-username/package-name"
}
Verify that your .npmrc file is configured to use the GitHub Packages registry for your package scope, for example:
@your-username:registry=https://npm.pkg.github.com