Using the Node version provided by Ubuntu isn't the best way to go; Node moves so fast that fixing the version isn't even an option!
We should install nvm with the manual install code from the [nvm repo](), then install the latest 4.x and 6.x versions, defaulting to 4.x (LTS). The following code snippet (running as the vagrant user) should do the trick:
# Specify major version - nvm does the rest
NODE_LTS_VERSION=4
NODE_STABLE_VERSION=6
export NVM_DIR="$HOME/.nvm" && (
git clone https://github.com/creationix/nvm.git "$NVM_DIR"
cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && . "$NVM_DIR/nvm.sh"
nvm install $NODE_STABLE_VERSION
nvm install $NODE_LTS_VERSION
nvm alias default $NODE_LTS_VERSION
nvm use default
Using the Node version provided by Ubuntu isn't the best way to go; Node moves so fast that fixing the version isn't even an option!
We should install nvm with the manual install code from the [nvm repo](), then install the latest 4.x and 6.x versions, defaulting to 4.x (LTS). The following code snippet (running as the vagrant user) should do the trick: