For Ubuntu 12.04:
sudo apt-get remove nodejs
This will uninstall nodejs as well as npm.
For Ubuntu 12.04:
sudo apt-get remove nodejs
This will uninstall nodejs as well as npm.
Edit: If you know which package manager was used to install, it is best to uninstall with the same package manager. Examples for apt, make, yum are in other answers.
This is a manual approach:
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.
I just checked the link you got this from. You are installing, specifically, version 0.10, or trying to at least, but you have a newer version in the repo that's being installed. You have to follow the setup for node v5.
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
PS: for future reference, make sure you read the sites very carefully especially when running commands as root.
EDIT: Alright, it seems that you added the repo correctly. Looking into the repo, your packages are there but the system is looking for the wrong version. At this point, I would suggest.
yum clean all && yum update
That will clean cached repo and grab from remote.
Answer:
After the work we've done over the chat, here's the correct answer for you. nodejs v5 installed fine. You previously compiled nodejs v0.12 manually, which is not a good idea on binary distros, because you will end up in this position.
which node
returned
/usr/local/bin/node
while
/usr/bin/node
returned the correct answer of v5.x.
At this point you have multiple options to fix it, but I would recommend 2.
- Option 1: This is the easy way out. You can edit your
.bashrcand add analiasthat will pointnode -> /usr/bin/node. This is as simple as addingalias node="/usr/bin/node". This will call the correct version every time but I cannot guarantee that it will not cause conflicts in the future with libraries. - Option 2: This is the hard way, but it will fix it. First, purge with
yumthe nodejs that is installed on the system. Second, get the tarball for the version you have compiled, untar it,./configureand uninstall it. This step, you can find online easily. Finally, reinstallnodejsthroughyum, and that should fix your problem.
What I did:
rm -f /etc/yum.repos.d/nodesource-el* curl -sL https://rpm.nodesource.com/setup_7.x | bash - yum install -y nodejs node --version
and I got:
v7.2.0