I experiencing an error when trying to publish an NPM package to Github Packages.
Firstly, I created a Personal Access Token ("PAT") with repo
, write
and read
scopes.
The I added a .npmrc file to my project with the following text:
//npm.pkg.github.com/:_authToken=ghp_6O8Ho[rest-of-token]
The, at the bash prompt, I entered the following (where myaccountname
is the name of my Github account):
npm login --scope=@myaccountname --auth-type=legacy --registry=https://npm.pkg.github.com
I entered my username next.
Then, for the password, I pasted my PAT.
Then, for the email, I entered the primary email address for my account and it seemed to succeed:
Logged in as myaccountname on https://npm.pkg.github.com/.
However, when I entered npm publish
, I got the following error:
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine usingnpm adduser
Then running npm add user
gave me a raft of whole new errors. But I cannot see that beinbg the right way to go anyway, as the Github doco does not mention that at all. It basically stops at npm publish
, suggesting that it should have worked.
Oh and the repository url (https) is specified as the repository
in package.json.
Can anyone see what I am missing?