See also:

Publishing an npm package to GitHub Packages

How to publish an npm package to GitHub Packages?
npm publish command

The GitHub package registry requires authentication for publishing with npm. Generate an access token and add this line to .npmrc:


You can either use ~/.npmrc or create an .npmrc file in you project's root.

The module name specified in the package.json file needs to have a scope. You can only publish packages with the scope matching your GitHub username or organization. For instance, the octocat Github user can only publish @octocat/xxx packages. If the octocat user is a member of the octo-org GitHub organization, they can publish @octo-org/xxx packages.

GitHub Packages are scoped to repositories. Each GitHub repository can have multiple packages. The package is published to the GitHub repository specified in the repository.url field of the package.json file.

Last updated on 3/9/2020 by Anton Vasetenkov.