0

Mac Catalina 10.15.6

I already had npm installed. I wanted to upgrade so I ran the following.

   npm install -g npm

Below is the output:

$name@$names-MacBook-Pro desktop % npm install -g npm /usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js npm ERR! code EEXIST npm ERR! syscall symlink npm ERR! path ../../../lib/node_modules/npm/man/man1/npm-bin.1 npm ERR! dest /usr/local/share/man/man1/npm-bin.1 npm ERR! errno -17 npm ERR! EEXIST: file already exists, symlink '../../../lib/node_modules/npm/man/man1/npm-bin.1' -> '/usr/local/share/man/man1/npm-bin.1' npm ERR! File exists: /usr/local/share/man/man1/npm-bin.1 npm ERR! Remove the existing file and try again, or run npm npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in: npm ERR!
/Users/$name/.npm/_logs/2020-10-04T14_41_02_611Z-debug.log

Now all NPM commands fail.

zsh: command not found: npm

Everything from:

npm -v

sudo npm install npm -g
seamus
  • 2,681
  • 7
  • 26
  • 49

2 Answers2

1

I just used home brew to upgrade NPM and it deleted and reinstalled all the necessary files.

seamus
  • 2,681
  • 7
  • 26
  • 49
0

This generally works for me on Mac:

brew upgrade
brew cleanup
brew install npm

(note you'll need the xcode tools if you don't have it - try xcode-select --install or check out this answer.)

Now, try npm install again and see if that changes anything.

Also, see this potentially related answer.

jkix
  • 184
  • 1
  • 2
  • 17