如何在 Ubuntu 中完全卸载 nodejs、npm 和 node [英] How can I completely uninstall nodejs, npm and node in Ubuntu

查看:534
本文介绍了如何在 Ubuntu 中完全卸载 nodejs、npm 和 node的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题类似于如何完全卸载 Node.js,并从头重新安装 (Mac OS X) 但对于 Ubuntu,仅用于卸载.

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.

安装完成:sudo apt-get install node

如何完全删除 npm 以及 npm 在我的系统上安装的所有库、包和任何其他文件,例如通过npm install -g @vue/cli?

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?

我确实打算在之后重新安装 npm.

I do plan to reinstall npm afterwards.

推荐答案

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

然后转到 /etc/apt/sources.list.d 并删除任何节点列表(如果有).然后做一个

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

sudo apt-get update

检查主文件夹中的任何 .npm.node 文件夹并删除它们.

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

如果你输入

which node

可以看到节点的位置.也试试 which nodejswhich npm.

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

我建议使用节点版本管理器(NVM)安装节点.这让我省了很多头痛.您可以使用 nvm 在没有 sudo 的情况下安装 nodejs 和 npm.

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.

这篇关于如何在 Ubuntu 中完全卸载 nodejs、npm 和 node的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆