First of all, you're going to need to install Node.JS. My personal preference is by using NVM (Node Version Manager) which will allow you to more easily select which version you want to use and also switch between them on the fly. You can install NVM by visiting their Git Repo or by running the following command:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash
Of course, that's assuming you have cURL installed and are using OSX or Linux.
Once you have NVM installed you will be able to install your desired version of Node with:
nvm install v4.0.0
To see a list of available versions, run:
Each time you install a new version of Node, you may want to make it your default:
nvm alias default v4.0.0
This way, the next time you open your terminal, it will have the correct version loaded.