If you install or publish packages through GitHub Packages, authentication is usually required.
A local machine may use the token in .npmrc:
@your-scope:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKENIn GitHub, go to:
- Settings
- Developer settings
- Personal access tokens
- Create a token appropriate for your use case
You usually need a token that can read packages.
You usually need package write permission as well.
The workflow can often use GITHUB_TOKEN instead of a manually copied token.
- never commit a real token to the repository
- keep only
.npmrc.exampleversioned - store the real
.npmrclocally or as a secret when appropriate - review package visibility and repository permissions in GitHub