Joe
Joe

Reputation: 13091

NodeJS package installation - 401 Unauthorized

Tried to install node package:

npm install nodemon

but it is failing with:

npm ERR! code E401
npm ERR! 401 Unauthorized: nodemon@latest

What should I do to fix it?

npm -v
6.5.0

node -v
v10.13.0

I tried npm cache verify and npm cache clean --force but still giving the same error.

Upvotes: 1

Views: 6271

Answers (1)

Joe
Joe

Reputation: 13091

I found the solution by searching different forums..

Need to check first if I am logged in npm whoami (for me was giving error).

Then checked /Users/myuser/.npmrc for any strange lines and passwords.

Then did npm login (I never tried login before). This forced me to enter username/pass (which I do not have) and it seems it created user/pass on the fly. After 'logging in' - it worked without issues.

Upvotes: 1

Related Questions