Keeping node.js dev stack up to date on Amazons EC2

Two months ago I created a simple tutorial for installing node.js on Amazons EC2. I’m using EC2 with node.js to work on some prototypes and proof of concepts.
node_ec2_npm

From the last installation I have:

  • node.js v0.10.8
  • npm 1.2.5

First, you have to update your EC2 instance (I’m using Amazon Linux AMI):

[ec2-user@... ~]$ sudo yum update
...
Complete!
[ec2-user@... ~]$ sudo yum clean all
...

Clean up mess (this is optional):

[ec2-user@... ~]$ sudo npm cache clean -f
npm WARN using --force I sure hope you know what you are doing.

Install n from npm:

[ec2-user@... ~]$ sudo npm install -g n
...

N is a node module that can update your current node version. You can also use nvm. I have no particular reason to use n over nvm.

Install latest stable version of node (you can also choose specific version like v0.10.11):

[ec2-user@... ~]$ sudo n stable

     install : 0.10.15
       mkdir : /usr/local/n/versions/0.10.15
       fetch : http://nodejs.org/dist/v0.10.15/node-v0.10.15-linux-x64.tar.gz
   installed : v0.10.15

Check your version of node:

[ec2-user@... ~]$ node -v
v0.10.15

Last step is to update node and global packages (like express, forever,…):

[ec2-user@... ~]$ npm update -g
npm http GET https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/forever
...

Check npm version:

[ec2-user@... ~]$ npm -v
1.3.5

And that’s it. If you have any questions or problems, feel free to ask. I will try to answer any question and help with any problems.

Leave a Reply

Your email address will not be published. Required fields are marked *