29

My Cloud 9 workspace is running with Node.Js 0.10. How can I update it to the latest version of Node.Js (today is 0.12.4)?

I'm trying to install Node.Js using apt-get but I will always get 0.10 version.

UPDATE: Latest version of Cloud 9 workspaces now have preinstalled version 4.1.1

Davide Icardi
  • 11,919
  • 8
  • 56
  • 77

3 Answers3

65

With Cloud 9 you can use NVM to install a new version of Node.js. Just run:

nvm install 5.5.0
nvm use 5.5.0
nvm alias default v5.5.0

NVM keeps all the versions so you can switch back whenever you want.

See also https://docs.c9.io/v1.0/docs/writing-a-nodejs-app.

Davide Icardi
  • 11,919
  • 8
  • 56
  • 77
26

To improve on Davide Icardi's answer, this installs the latest stable version:

nvm install stable

Worked for me in Cloud9.

Joe Maffei
  • 1,855
  • 1
  • 15
  • 18
1

Are you running Debian/Ubuntu? As an alternative to nvm, you can:

curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
sudo apt-get install -y nodejs

source

mpen
  • 272,448
  • 266
  • 850
  • 1,236
  • Yes, I always use that command on my "physical" machine, but I don't know why this doesn't work on Cloud 9, probably because it already has NVM installed that override the system installation? – Davide Icardi Jun 03 '15 at 22:28
  • 1
    run `which node`. that will tell you what you're using. you can remove `[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"` from your `.bashrc` if you don't want to use `nvm` anymore. or if like `nvm`, do what Davide suggests. – mpen Jun 03 '15 at 22:36