Github Package Registry package not found within same account

I have 2 repositories. I published a package for one of them to github registry. An app in the second repository relies on this package as a dependency. 

In my package.json, I have this dependency added as:

“@{username}/component”: “2.1.0”

This runs fine locally when everything is done manually. However when I try running it through github actions I get the following error when npm install is ran: 

npm ERR! code E404

npm ERR! 404 Not Found - GET{username}/@{username}%2fcomponent - npm package “component” does not exist under owner “{username}”

npm ERR! 404

npm ERR! 404 '@{username}/component@2.1.0 is not in the npm registry.

Any ideas on the cause or workarounds? Is it possible to have access to other private packages within the same account using GITHUB_TOKENS through actions? Thanks.

I’ve encountered this issue as well and after reaching out to Github Support, here’s what they said:

“it looks as though we aren’t currently returning an accurate error message when you have maximised your allowed usage limitations for private packages”

I found this extremely odd, given that my packages are only KBs in size and I seem to hit the limit very quickly, after only several npm publish attempts.

I believe this is a bug and I’ve reached out to Github Support for a better explanation of how they calculate Data Transfer Out. 

In the meantime, my workaround is to add a small monthly spending limit.  Alternatively, making your package public will work too.

Hope this helps!

The GITHUB_TOKEN’s permissions are limited to the repository that contains your workflow. So it doesn’t have enough permission to get package from another private repo.

Please try to create a personal access token (PAT) with read packages scope , then store the token in secrets in your second repository, and refer to it using the ${{ secrets.SECRET_NAME }} syntax in your workflow. For more information, see “Creating and using encrypted secrets.

There is my example:

npm install.png