How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
⚡TLDR
To eradicate Node.js and its traces from your Mac, run these commands:
For a fresh-as-a-daisy Node.js installation, no sweat, just run:
Like wiping out Lord Voldemort's horcruxes, this ensures a fresh start for your Node.js journey.
Uninstallation: Total annihilation
Git rid of Node.js and leftovers
Old baggage affects performance. Kick out the lurking traces of Node.js before you bring in the spanking fresh setup. Here, we're aiming for an Apollo mission, not a haunted house tour.
- Exorcise Node if it was installed with Homebrew (the exorcism charm):
- Blast off directories and configurations which may have Node files and caches (like cleaning out the Room of Requirement):
- Clean your system's PATH. If your
.bashrc
,.bash_profile
,.zshrc
, or.profile
have traces of Node, remove these lines (men-in-black-style memory erase).
Homebrew magic for reinstallation
- Potion check with Homebrew using
brew doctor
and clear the cauldron usingbrew cleanup --prune-prefix
, ensuring the fresh potion brews perfectly. - Begin the magic:
- Test the magic wand using these verification commands:
Nvm: The chameleon's charm
Having a Node version manager like nvm
is like Hermione's beaded bag — easy to bring in and toss out any Node.js version anytime, anywhere.
- Summon nvm by downloading from the official source:
- Use nvm to fetch the latest Node.js and npm without needing Homebrew:
- With nvm, you're the Doctor Who of Node.js versions. Slide back to any previous Node.js version:
Shifting shades with AVN
For fellow time travellers dealing with multiple Node versions, AVN
(Automatic Version Switcher) is your ticket to effortless adaptation.
- Follow the marauder's map to install and set up AVN.
Inside Scoops: Tips and Tricks
Warding off installation dementors
- To identify potential phantoms for deletion, the spell is
lsbom
for macOS specific files, simplifying hunting of Node.js-related files. - Repeat the exorcism if needed; Node.js, if installed in different ways, can be more difficult to drive out than Peeves the Poltergeist.
Post-clean-up beau geste
- Master the cleaning charm by running
brew cleanup
time-to-time. It removes old potions (versions) and residues, keeping your witch's brew (Homebrew) in excellent condition. - For a smoother magical journey, abide by the wisdom in NVM's GitHub repository: nvm-sh/nvm.
Linked
Was this article helpful?