npm install gives unauthorized name or password is incorrect error

喜夏-厌秋 提交于 2019-12-02 20:13:56

Found the answer.

Remove .npmrc from my home directory and it works!

Thanks to mcollina https://github.com/mcollina at https://github.com/isaacs/npm/issues/2778

 1.>Go to your this location

    C:\Users\{your user name or ID}

 2.> open .npmrc & Remove all content from .npmrc file.

 3.>reopen your new command prompt

 4.>again run the code , will work.

I was also having this problem. Mine has arised because I have changed my password in npmjs.org. So, try Login in npm from terminal again with your new password and then install any module. It worked for me.

You might have _auth entry configured in the .npmrc config file ($HOME/.npmrc). Just delete the entry if you are using the public registry as it's not needed. If you're using a private npm registry you should check with your admin that that's the correct auth key for you to access the registry.

I would not recommend just deleting the whole file (.npmrc) as the file might contain important configurations for your npm to work correctly. i.e.: proxy config.

Also you can use

npm cache clean

Removing package-lock.json and node_modules did the trick in my case.

i tried

npm cache clean

but it didn't work. I didn't see .npmrc in my directory. I killed my bash shell (terminal on mac) and brought up a new one and that seemed to do the trick. Not sure if it was the bash refresh or the npm cache clean or a combination of the two.

npm cache verify is what you need

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!