'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://docs.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.



Solution 1:[1]

First run:

vsts-npm-auth -config .npmrc -force

and then:

npm i

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tyler2P