Download NPM package from Github Packages

I’ve created a private repository inside an organization and successfully published a package into Github Packages (it’s available on the packages section of the repository)

However I’m unable to install the package from the command line.

I followed the documentation in order to autenticate using my personal access token (with all the necessary permissions):

$ npm login --scope=@OWNER --registry=

> Username: USERNAME
> Password: TOKEN

OWNER being the organization name. This works as expected and I can login without trouble, however I get a 401 error message when using the install command (exactly the same command available in the packages section):


401 Unauthorized - GET

  • Your request could not be authenticated by the GitHub Packages service.
    Please ensure your access token is valid and has the appropriate scopes configured.

If I go to that same URL in the browser and I put again my username and Personal Access Token, it allows me access to it.

I don’t understand what I’m doing wrong, any suggestions?

So in the end the problem was that I had a GITHUB_TOKEN in my .npmrc and that token it seems it has no access to install private repositories and was taking precedence over the npm login command.