fritz6
fritz6

Reputation: 103

npm ERR! Unable to authenticate, need: Basic realm="https://pkgsprodsu3weu.app.pkgs.visualstudio.com/"

I ran npm i @wtw/canvas and got this error:

npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="https://pkgsprodsu3weu.app.pkgs.visualstudio.com/"

My .npmrc:

@willistowerswatson:registry=https://rcss-willistowerswatson.pkgs.visualstudio.com/_packaging/Core@Local/npm/registry/
registry=https://registry.npmjs.org/
//always-auth=true
//pkgs.dev.azure.com/rcss-willistowerswatson/RadarEnterprise/_packaging/RadarEnterprise/npm/registry/:username=VssSessionToken

I have already tried:

vsts-npm-auth -config C:\Users\wilso224\.npmrc

vsts-npm-auth v0.41.0.0
-----------------------
Already have credentials for https://rcss-willistowerswatson.pkgs.visualstudio.com/_packaging/Core@Local/npm/registry/

This also failed:

npm i --registry https://registry.npmjs.org @wtw/canvas

result:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@wtw%2fcanvas - Not found
npm ERR! 404
npm ERR! 404  '@wtw/[email protected]' is not in the npm registry.

I have already read the following:

npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm"

npm token list giving error

https://learn.microsoft.com/en-gb/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows%2Cclassic#set-up-authentication-on-your-dev-box

https://developercommunity.visualstudio.com/t/401-when-attempting-to-run-npm-install/928369

Thanks.

EDIT#1 I tried npm login anyway which asked me to set up a new account, etc. I have been on this job for 3+ years and I don't recall needing to set up an account every time I encounter error of this sort.

Upvotes: 4

Views: 5152

Answers (2)

HCJMartin
HCJMartin

Reputation: 51

If the forced re-auth doesn't work, you may need to clean and reinstall vsts-npm-auth

These steps worked for me:

  1. Uninstall vsts-npm-auth
npm uninstall -g vsts-npm-auth
  1. Clean npm cache
npm cache clean --force
  1. Delete the .npmrc file

  2. Reinstall

npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false

Microsoft Documentation:
https://learn.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows%2Cclassic#reset-vsts-npm-auth

Upvotes: 2

Erik van den Berg
Erik van den Berg

Reputation: 81

First run:

vsts-npm-auth -config .npmrc -force

and then:

npm i

Upvotes: 8

Related Questions