I am trying to release npm package through GitHub Package Registry, I am following the documentation, When I try to login using the below command after entering the username
and password
(even though both are correct), I am getting below error always.
// Step 2: Authenticate
$ npm login --registry=https://npm.pkg.github.com/
Error log:
npm login --registry=https://npm.pkg.github.com/
Username: ***********
Password:
Email: (this IS public) *****************
npm ERR! code E401
npm ERR! Registry returned 401 for PUT on https://npm.pkg.github.com/-/user/org.couchdb.user:kgangadhar: Error authenticating user: Bad credentials
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\karth\AppData\Roaming\npm-cache\_logs\2019-10-31T05_35_05_829Z-debug.log
Does anyone know how to resolve it?
Do you have 2-factor authentication enabled on your GitHub account? If so, try creating a personal access token and using that instead of a password. Here are instructions to create a token.
Update: Github now requires personal access tokens for all accounts, regardless of if you have 2fa enabled