Completly uninstall nodejs, npm and node in ubuntu 14.04

断了今生、忘了曾经 提交于 2019-11-26 21:34:36
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 head ache for me. Because you can install nodejs and npm without sudo using nvm.

Amit Malik

This is better to remove NodeJS and its modules manually because installation leaves a lot of files, links and modules behind and later it create problems while we reconfigure another version of NodeJS and its modules. Run the following commands.

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules 

sudo rm -rf /usr/local/lib/node*

sudo rm -rf /usr/local/include/node*

sudo rm -rf /usr/local/bin/node*

and this done.

A step by step guide with commands is at http://amcositsupport.blogspot.in/2016/07/to-completely-uninstall-node-js-from.html

This helped me resolve my problem.

Amit Malik

To remove nodejs, npm and node_modules from Ubuntu, you need to remove containers also which are at different locations in Ubuntu.

These could be:

/usr/local/bin/npm
/usr/local/share/man/man1/node
/usr/local/lib/dtrace/node.d
~/.npm
~/.node-gyp
/opt/local/bin/node
opt/local/include/node
/opt/local/lib/node_modules

I did it successfully. So I am sharing the full procedure.

You need to follow the steps that are described here: http://amcositsupport.blogspot.in/2016/07/to-completely-uninstall-node-js-from.html

To completely uninstall node js from Ubuntu

To manually remove node js, npm and node_modules from Ubuntu, you need to do the following steps.

  1. First of all you need to run the following command from command terminal as sudo.

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules

  1. Remove node or node_modules directories from /usr/local/lib with the help of following command.

sudo rm -rf /usr/local/lib/node*

  1. Remove node or node_modules directories from /usr/local/include with the help of following command.

sudo rm -rf /usr/local/include/node*

  1. Remove any node file or dir from /usr/local/bin with the help of following command.

sudo rm -rf /usr/local/bin/node*

  1. Go to home directory and remove any node or node_modules directory, if exists.
DarckBlezzer

I was crazy delete node and npm and nodejs from my ubuntu 14.04 but with this steps you will remove it...

sudo apt-get uninstall nodejs npm node
sudo apt-get remove nodejs npm node

if you uninstall correctly and it is still there, beffore this check links at bottom...

//this will fine the `/usr/bin` or `/usr/local/bin`
find / -name "node"
// check path of program...
ls -l node
//and remove it
rm -rf /usr/bin/node

More information
Remove - Official website
If you installed via git repository Try purge nodejs npm and node

For those who installed node.js via the package manager, can just run:

sudo apt-get purge nodejs

Optionally if you have installed it by adding the official NodeSource repository as stated in "Installing Node.js via package manager", do:

sudo rm /etc/apt/sources.list.d/nodesource.list

If you want to clean up npm cache as well:

rm -rf ~/.npm

It is bad practice to try to remove things manually, as it can mess up the package manager, and the opearating system itself.

It bothered me too much while updating node version from 8.1.0 to 10.14.0

here is what worked for me-

  1. open terminal (crtl+alt+t).
  2. type which node, will give path something like
  3. /usr/local/bin/node
  4. rm -rf node , will remove node
  5. node -v, no node version ...
  6. curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
  7. sudo apt-get install -y nodejs

Note:-if you are getting error like-

node /usr/bin/env: node: No such file or directory

just run-

ln -s /usr/bin/nodejs /usr/bin/node

sorce here

  1. node -v // will give v10.14.0

Worked for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!