Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fixing npm On Mac OS X; When npm install -g does not work

Nuke Everything node/npm related

(If you have setup another prefix)
rm -rf .npm-global

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
brew uninstall node --ignore-dependencies node
rm -rf /usr/local/lib/node_modules

Install node (includes npm) from the nodejs website

To avoid using sudo with npm

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

@Benjamin-Lee

This comment has been minimized.

Copy link

Benjamin-Lee commented Apr 7, 2019

Having the same issue! However, brew is giving me the following error:

brew uninstall node --ignore-dependencies --force node

Uninstalling node... (304 files, 2.3MB)
Error: Could not remove /usr/local/Cellar/node/8.2.1! Check its permissions.
@ezgcmr

This comment has been minimized.

Copy link

ezgcmr commented May 23, 2019

Having the same issue! However, brew is giving me the following error:

brew uninstall node --ignore-dependencies --force node

Uninstalling node... (304 files, 2.3MB)
Error: Could not remove /usr/local/Cellar/node/8.2.1! Check its permissions.

did you try with sudo ?

@JanieHuang

This comment has been minimized.

Copy link

JanieHuang commented Jun 28, 2019

Hi same error,

brew doesn't support usage of sudo anymore

@sec0ndhand

This comment has been minimized.

Copy link

sec0ndhand commented Aug 18, 2019

@edPratt

This comment has been minimized.

Copy link
Owner Author

edPratt commented Aug 30, 2019

@Benjamin-Lee I might have manually remove that (?)cask(?) before running the node uninstall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.