Home > Enterprise >  npm login not allowing login to github
npm login not allowing login to github

Time:11-22

When I try to run the following in the terminal it should ask me for username and password but nothing comes up other than the error bellow.

npm login --registry=https://npm.pkg.github.com --scope=@Psychedelic

npm notice Log in on https://npm.pkg.github.com/
npm ERR! code ENYI
npm ERR! Web login not supported`

Any ideas?

I think i might need to create a ~/.npmrc file with token etc but can't work out how to do that.

CodePudding user response:

Had the same issue and this worked for me:

Add .npmrc file to your project in the same directory as your package.json file with this content:

@OWNER:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=TOKEN

Replace OWNER with the name of the user or organization account on GitHub that owns the repository containing your project, And TOKEN with your personal access token (classic).

I did the steps above instead of npm login --scope=@OWNER --registry=https://npm.pkg.github.com. Followed by a npm run build at the end.

Read the documentation on Working with the npm registry for more.

CodePudding user response:

Since npm v9, --auth-type=legacy argument is required to authenticate with GitHub Packages.

https://docs.npmjs.com/cli/v9/commands/npm-login

  • Related