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:
> user-ubuntu:/usr/local$ npm -v
Remove it by running the following command(refer here:
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”):
When installing “CoffeeScript” package by using npm, use the following command:
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.