Skip to content

Instantly share code, notes, and snippets.

@jamalhassouni
Forked from edPratt/mac-osx-node-npm.md
Created March 31, 2019 11:00
Show Gist options
  • Save jamalhassouni/f371d85ccb17020fb1521e61d42746f6 to your computer and use it in GitHub Desktop.
Save jamalhassouni/f371d85ccb17020fb1521e61d42746f6 to your computer and use it in GitHub Desktop.
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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment