How to update Node.js

nodejs

#1

Does Cloud9 support Node.js v5? If so, how do I upgrade my workspace environment to use a newer version of Node?


Node JS Version
Nodejs v8 Support
Vue CLI not working
Need newer version of Node
#2

Your Cloud9 hosted workspace comes with nvm preinstalled so installing and using different versions of Node.js is very easy.

How to install a Node.js version

Say you want to install Node v6.9.1 you would write on the terminal:

nvm install 6

It’s that simple :slight_smile:

How to change Node.js versions

If you have multiple versions of Node.js installed on your workspace, you can switch to a specific version by writing:

nvm use 0.10.40

Making a node version default

In order to set a default version of node for your workspace, just type:

nvm alias default 6

Where 6 was the version you wanted to be used as default.


#3

Thanks! That worked. I had set a bash_profile which was preventing me from using nvm.


#4

Nice, just what I was looking for. Also works for latest Node.js v6.4.0. Thanks Brady!


#5

the x5 ver update command:
curl -sL https://deb.nodesource.com/setup_5.x | sudo bash -
sudo apt-get install nodejs


#6

@yahiakemari, you can just do:

nvm install 6.9.2
nvm alias default 6.9.2

For whatever version you want to use, rather than adding the nodesource repo (that will save you disk space and time).


#7

I did this, and it worked but now nodemon doesn’t work. It now says bash: nodemon: command not found

How do I fix this?


#8

type node -v and check the version…

for some reason, Cloud 9 is reverting node back to 4.7.3 in my case

How can node 6 be made permanent?


#9

@netomarchiori did you run nvm alias default <version> command as suggested by ryanpcmcquen?
@melaniecarr23 when you install new version of node via nvm it starts with fresh global node_modules folder, you need to install nodemon again


#10

yes i did, but i have to run it every time the environment is restarted. is there any way to make it run automatically when the environment restarts?


#11

what do you see when running nvm ls?


#12

i see

         v4.7.3
->      v6.11.0
         system
default -> 6 (-> v6.11.0)
node -> stable (-> v6.11.0) (default)
stable -> 6.11 (-> v6.11.0) (default)
iojs -> N/A (default)

uninstalling 4.7.3 would work?


#13

that looks correct, i don’t see why it would revert to 4 after restart.
Uninstalling 4 seems like a good idea, please let me know if the problem persists after that.


#14

I am experiencing the same issue as netomarchiori. My default is set to 8.1 but the version of node at startup is always 4.7.3


#15

I get this error when I run nvm install 6
bash: nvm: command not found


#16

I received this error
bash: nvm: command not found