Uninstall Node.JS using Linux command line?

2019-01-04 05:01发布

How do you uninstall node.js using the cmd line in linux?

12条回答
戒情不戒烟
2楼-- · 2019-01-04 05:16

In Ubuntu 12.04 simply type this

$ sudo apt-get remove nodejs

It will uninstall nodejs and npm as well simple.

查看更多
爷、活的狠高调
3楼-- · 2019-01-04 05:17

Sorry the The answer of George Bailey does work very fine when you want absolutely remove the node from your machine.

This answer is referred from : @tedeh https://github.com/nodesource/distributions/issues/486

If you wanna install a new version of node you have to use the code below

sudo rm -rf /var/cache/yum
sudo yum remove -y nodejs
sudo rm /etc/yum.repos.d/nodesource*
sudo yum clean all

And add new nodejs version to "yum" an new version of node

#using this command for Node version 8
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -

#using this command for Node version 10
curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -

Install nodejs

sudo yum -y install nodejs

I hope it gonna help you guy!!!

查看更多
我命由我不由天
4楼-- · 2019-01-04 05:17

I think this works, at least partially (have not investigated): nvm uninstall <VERSION_TO_UNINSTALL> eg:

nvm uninstall 4.4.5

查看更多
做自己的国王
5楼-- · 2019-01-04 05:19

The answer of George Bailey works fine. I would just add the following flags and use sudo if needed:

 sudo rm -rf bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node
查看更多
看我几分像从前
6楼-- · 2019-01-04 05:24

If you installed node using curl + yum:

sudo curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
sudo yum -y install nodejs

Then you can remove it using yum:

sudo yum remove nodejs

Note that using the curl script causes the wrong version of node to be installed. There is a bug that causes node v6.7 to be installed instead of v4.x intended by the path (../setup_4.x) used in the curl script.

查看更多
萌系小妹纸
7楼-- · 2019-01-04 05:29

Running which node will return something like /path/bin/node.

Then run cd /path

This is all that is added by Node.JS.

rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1

Now the only thing I don't know about is npm and what it has installed. If you install npm again into a custom path that starts off empty, then you can see what it adds and then you will be able to make a list for npm similar to the above list I made for node.

查看更多
登录 后发表回答