Answer a question

The Question is similar to How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) but for Ubuntu, and just for uninstalling.

Installation was done by: sudo apt-get install node

How do I completely remove npm along with all libraries, packages and any other files installed by npm on my system, via e.g. npm install -g @vue/cli?

I do plan to reinstall npm afterwards.

Answers

sudo apt-get remove nodejs
sudo apt-get remove npm

Then go to /etc/apt/sources.list.d and remove any node list if you have. Then do a

sudo apt-get update

Check for any .npm or .node folder in your home folder and delete those.

If you type

which node

you can see the location of the node. Try which nodejs and which npm too.

I would recommend installing node using Node Version Manager(NVM). That saved a lot of headache for me. You can install nodejs and npm without sudo using nvm.

Logo

Ubuntu 社区为您提供最前沿的新闻资讯和知识内容

更多推荐