publishing to npm fails after publishing to GPR
See original GitHub issueI have a workflow like this that’s supposed to publish to npm once I publish to GPR:
name: Publish to npm
on: registry_package
jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm install && npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
I have the npm_token
secret added to this repository.
When I just published to GPR, it kicked off this workflow job, but it failed at the last step of publishing to npm. The error was from npm saying:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"
What does this error mean, and how do I fix it? I don’t see anything about setting “basic realm” in the recipes for this setup-node
action.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:16
- Comments:36 (5 by maintainers)
Top Results From Across the Web
getting not found error when trying to publish package to npm
I'm trying to publish a new package to npm, public. I have the following workflow: # This workflow will run tests using node...
Read more >How to publish an npm package to npm and GitHub Package ...
The first is to build the project. The second is to publish to npm, and the third is to publish to GitHub Package...
Read more >npm-publish | npm Docs
The publish will fail if the package name and version combination already exists in the specified registry. Once a package is published with...
Read more >NPM Publish to GPR and NPM | Mitchell Simoens Blog
I've seen a few blogs about publishing a node module to the NPM repository and GitHub Package Registry (GPR). Some I like, some...
Read more >How to publish NuGet packages | Microsoft Learn
nupkg file, run the following command. Specify your .nupkg filename, and replace the key value with your API key. .NET CLI Copy.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@pqt Just to be clear: You’re talking about publishing to GitHub Package Registry only (not the npmjs.org registry)? Because I’ve got that working from within GitHub Actions, with this
.npmrc
In the workflow config, I don’t use any
with:
arguments for the Node setup (exceptnode-version: '10.x'
), and I set a personal access token (as secret) for theNODE_AUTH_TOKEN
env var (I think theGITHUB_TOKEN
would also work).Is that what you’re trying to accomplish or am I totally misunderstanding you?
PS: That
.npmrc
is in the repo root, not at~/.npmrc
. Simply commited that file.I also had the same issue, and fixed by creating
~/.npmrc
like: