sunmingtao / sample-code

3 stars 4 forks source link

NPM: npm ERR! Incorrect or missing password. #281

Closed sunmingtao closed 3 years ago

sunmingtao commented 3 years ago

Getting error when running npm install

npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR! 
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/msun/.npm/_logs/2021-05-06T04_50_43_250Z-debug.log
sunmingtao commented 3 years ago

npm -v show version 7.12, which is the culprit

Solution:

Uninstall node and npm

brew uninstall node;
which node;
sudo rm -rf /usr/local/bin/node;
sudo rm -rf /usr/local/lib/node_modules/npm/;
brew doctor;
brew cleanup --prune-prefix;

Reinstall node and npm version 6.

brew install node
npm install -g npm@6