Gangmax Blog

How to remove nodejs manually from Ubuntu

Here is a step-by-step guide to remove the existing old “node.js” from my Ubuntu 10.04 manually and reinstall the latest version of “node.js”.

The “node.js” in my environment was installed from source and the version information is:

1
2
3
4
> user-ubuntu:/usr/local$ npm -v
1.1.49
> user-ubuntu:/usr/local$ node -v
v0.9.1-pre

Remove it by running the following command(refer here:

1
sudo rm -r bin/node bin/npm include/node lib/node_modules share/man/man1/node.1

For the npm modules, my ones were installed under the “~/npm_modules” directory and can be removed manually any time I like, or if I don’t remove them, after I install a new version of node.js they can still be used.

Install the latest version (at this time it’s “0.10.5”):

1
2
3
4
./configure
make
sudo make install
# For later uninstallation, I think I can run "sudo make uninstall" from here, or(if no source code available at that time) run "sudo rm -r bin/node bin/npm lib/node_modules share/man/man1/node.1" (The "include/node" is not existing in version "0.10.5")

When installing “CoffeeScript” package by using npm, use the following command:

1
sudo npm install -g coffee-script

The “-g” option(global) makes the “coffee-script” pacakge be installed under the “/usr/local/lib/node_modules/coffee-script/“ directory and then the “coffee” command(“/usr/local/bin/coffee”) can be used properly. So when uninstalling “node.js”, don’t forget to remove the “/usr/local/bin/coffee” file as well.

Comments