How to update nodejs on mac?
Solution 1:
Is /usr/local/bin/npm
a broken symlink? That would make sudo npm
print an error like command not found
and npm
print an error like No such file or directory
.
You could try creating a new symlink for node:
$ rm /usr/local/bin/npm; brew unlink node; brew link node
Unlinking /usr/local/Cellar/node/0.10.5... 4 links removed
Linking /usr/local/Cellar/node/0.10.5... 5 symlinks created
$ sudo /usr/local/bin/npm uninstall npm -g
Or use /usr/local/opt/node/bin/npm
:
$ ls -l `brew --prefix node`
lrwxr-xr-x 1 lauri admin 21 Jun 14 18:27 /usr/local/opt/node -> ../Cellar/node/0.10.5
$ sudo /usr/local/opt/node/bin/npm uninstall npm -g