Hey everyone! I’m trying to do a clean sweep of Node.js and NPM from my Ubuntu machine. I originally installed Node.js using sudo apt-get install node, but now I want to get rid of everything.
I’m talking about:
Node.js itself
NPM
All the global packages I’ve installed (like @vue/cli)
Any other files or libraries that came along for the ride
Does anyone know the most thorough way to do this? I’m planning to reinstall everything fresh afterward, but first I want to make sure I’ve wiped the slate clean.
Here’s a quick example of what I’ve tried, but I’m not sure if it’s enough:
I’ve been down this road before, and let me tell you, it can be a bit tricky to get everything cleaned up. Here’s what worked for me:
First, I’d recommend using the Node Version Manager (NVM) to uninstall Node.js. It’s much cleaner than just removing packages. If you don’t have NVM, you can install it and then use it to remove Node.
Then, I’d go through and remove any global packages manually. You can list them with npm list -g --depth=0 and remove each one.
After that, I’d clean up any leftover directories: