Home > Enterprise >  npm won't let me publish even after I have logged in
npm won't let me publish even after I have logged in

Time:01-31

When I try git push --follow-tags origin master && npm publish it ends with

npm notice name:          @hoodedunicorn/arduinohc05app
npm notice version:       0.1.12
npm notice filename:      hoodedunicorn-arduinohc05app-0.1.12.tgz
npm notice package size:  6.4 MB
npm notice unpacked size: 24.1 MB
npm notice shasum:        d151f64e3e5a487e8c30e59b72119864ac6f0d7a
npm notice integrity:     sha512-enKDkj0kplQwx[...]rq5Qjlm4Wpyvg==
npm notice total files:   497
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://npm.pgk.github.com/
npm ERR! need auth You need to authorize this machine using npm adduser

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\yadayada\mydebug.log

Okay I thought, no biggie just add user.

npm adduser --auth-type=legacy
npm notice Log in on https://npm.pkg.github.com/
Username: hoodedunicorn
Password:
Email: (this IS public) [email protected]
Logged in on https://npm.pkg.github.com/.

npm whoami
HoodedUnicorn

then log in

npm login --scope=@HoodedUnicorn --auth-type=legacy --registry=https://npm.pkg.github.com
npm notice Log in on https://npm.pkg.github.com/
Username: hoodedunicorn
Password:
Logged in to scope @HoodedUnicorn on https://npm.pkg.github.com/.

Okay, everything seems good. Let's try that command again in the beginning git push --follow-tags origin master && npm publish

npm notice total files:   497
npm notice
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://npm.pgk.github.com/
npm ERR! need auth You need to authorize this machine using npm adduser`

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\yadayada\mydebug1.log

So I try again

npm adduser --scope=@HoodedUnicorn --auth-type=legacy --registry=https://npm.pkg.github.com
npm notice Log in on https://npm.pkg.github.com/
Username: hoodedunicorn
Password:
Email: (this IS public) [email protected]
Logged in to scope @HoodedUnicorn on https://npm.pkg.github.com/.

git push --follow-tags origin master && npm publish

Same error, npm ERR! need auth You need to authorize this machine using npm adduser but npm whoami returns HoodedUnicorn What is going on?

CodePudding user response:

  • Run npm login --registry=https://npm.pkg.github.com to login before publishing
    [Note: Make sure you have created a git access token with scopes: write:packages,repo,delete:packages or click here to create a new token]
  • Run npm whoami if you are not there then run npm adduser --registry=https://registry.npmjs.org/:_authToken=<token-from-npm> to add yourself as a publisher

Follow the steps here: Github NPM Package Registry > Publish

  • Related