Watch on YouTube: youtu.be/ogprXGQWrQk

It's EASY!

First get some build tools

sudo apt-get update
sudo apt-get install \
  git \
  build-essential \
  wget

Now download and extract the source from nodejs.org (check there for an updated link for the latest version)

wget http://nodejs.org/dist/v0.8.18/node-v0.8.18.tar.gz
tar xvf node-v0.8.18.tar.gz
pushd node-v0.8.18
./configure
make
sudo make install
node --version
node

Feel free to play around...

> 0.1 + 0.7
0.7999999999999999
> process.exit() // or `<ctrl>+d`

All is working as expected. Now install served (analogous to python -m SimpleHTTPServer 3000) for fun.

sudo npm install -g served
served 3000

And visit http://localhost:3000 to see it in action. Then hit <ctrl>+c to kill it.

Where to go next?

JavaScript is NOT a language for beginners... yet it's the most accessible language.

The most important thing I will ever tell you: ALWAYS "use strict";!!! Start every javascript file like the one below:

/*jshint es5:true node:true */
(function () {
  "use strict";

}());

If you npm install -g steve-tools you will get mkjs which is what I use to create new files before I even vim them.

Also, make sure you npm install jshint and install syntastic for vim or sublime-jshint, if you swing that way.

And go through the material here

Problems

If you ever have problems with node modules the best thing to do is usually to remove all of the node_modules directories from the project (and any directory above it) and try again.

rm -rf ~/node_modules/
find . -type d -name node_modules -exec rm -rf {} \;

Cleaning up after yourself

If you need to backtrack and start over, here's how you get fresh:

Uninstalling for the system

If you believe that something is severly botched and you want to manually uninstall node try this:

mv ~/.npmrc ~/.nmprc.bak

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

Uninstalling locally

mv ~/.npmrc ~/.nmprc.bak

rm ~/local/*/node* -rf
rm ~/local/*/npm* -rf
rm ~/.node_* -rf

By AJ ONeal

If you loved this and want more like it, sign up!


Did I make your day?
Buy me a coffeeBuy me a coffee  

(you can learn about the bigger picture I'm working towards on my patreon page )