Skip to content

Instantly share code, notes, and snippets.

@kof
Last active March 7, 2021 08:41
Show Gist options
  • Save kof/75e02ba2d43f72d02d2c96825086106f to your computer and use it in GitHub Desktop.
Save kof/75e02ba2d43f72d02d2c96825086106f to your computer and use it in GitHub Desktop.
Complete wipe of all node related files for MacOS
#!/bin/bash
yarn cache clean
npm cache clean --force
sudo rm -rfv /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
sudo rm -rfv ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.yarnrc ~/.node_repl_history
sudo rm -rfv /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp
sudo rm -rfv /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm*
sudo rm -rfv /usr/local/include/node /usr/local/include/node_modules
sudo rm -rfv /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d
sudo rm -rfv /opt/local/include/node /opt/local/bin/node /opt/local/lib/node
sudo rm -rfv /usr/local/share/doc/node
sudo rm -rfv /usr/local/share/systemtap/tapset/node.stp
brew uninstall -fv node
brew doctor
brew cleanup --prune-prefix
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
# Then install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment