Note: This setup is best for development directly on Ubuntu Server, which is a setup my situation requires. I plan to write another post on creating a production Node server very soon. If it’s something you need right away, ping me in the comments below and light a fire under me!
- Update your system and install prerequisites.
123sudo apt-get updatesudo apt-get upgradesudo apt-get install openssl libssl-dev
- If you haven’t already, install Node Version Manager. We will install specific versions of node with nvm lower down.
123cd ~git clone git://github.com/creationix/nvm.git ~/nvm. ~/nvm/nvm.sh
- Add the last line above line to your .bash_login file. (create if necessary)
12cd ~nano .bash_login
- Sign out and back in and you will now be able to execute the nvm command and see the usage options.
- Check the NodeJS website to see what the latest stable version is.
- Install a specific version of node – (beware: this takes several minutes).
1nvm install v0.6.18
NOTE: If you have problems, and attempt to install Node a second time, something could get botched and you might get an error like “HTTP server doesn’t seem to support byte ranges. Cannot resume.”. The solution is to remove the source files (BE CAREFUL), then try again:1rm -Rf ~/nvm/src/*
- Make the newly installed version your default.
1nvm alias default 0.6.18
- Install npm with one line from your home directory(!)
1curl https://npmjs.org/install.sh | sh
- If you’re developing in Node, I highly recommend the wonderful nodemon by Remy Sharp for automatically restarting your server when files change.
1npm install nodemon -g
- If you’re using the high performance redis adapter, make sure to recompile.
12cd /project/foldernpm install hiredis
or alternatively,1npm rebuild
- Test the new version with your code.
- See what old Node versions you have installed.
- Uninstall old versions if desired.
1nvm uninstall v0.6.16