The Question is similar to https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x but for Ubuntu, and mainly concerns the cleanup part.
Installation was done as usual by: sudo apt-get install node
, however I later used the npm
command to install multiple packages as more than one users.
How do I completely remove npm along with all libraries, packages and any other files installed by npm on my system by e.g. npm install -g @vue/cli
? I would probably have to uninstall from apt
, but the main question has to do with all the changes npm
did.
Notes:
- I am on Ubuntu 20.04 LTS npm version 7.5.6 if that matters
- As there seems to be some fights about people uninstalling npm going on currently, please do not downvote just because I want to uninstall, I plan to reinstall 🙂
Edit-Reminder to future self and others:
For reinstalling without sudo , a link with recipes can be found here. It is still unclear to me what's best but https://stackoverflow.com/questions/10081293/install-npm-into-home-directory-with-distribution-nodejs-package-ubuntu on the other hand there is README.md#debinstall so possibly use apt to install node, then use prefix…
Best Answer
This will be messy ...
The simplest solution that I have found to this problem when trying to "fix" a broken development server that couldn't be formatted and rebuilt from scratch due to "management" is this:
/home
directories and/root
Here's the basic process:
-S
flag will also remove the reference in yourpackage.json
file⇢
/etc/npmrc
⇢
/home/youruser/.npmrc
⇢
/root/.npmrc
⇢
./.npmrc
in any project directory next topackage.json
(search by usinglocate .npmrc
)/bin
:At this point, you can reinstall Node and its package manager if you wish to start over with a clean slate.