0

We initialize node.js using nvm use 0.10.0 How to configure user environment to use the latest node runtime, so that the bash shell gets initialized when I launch a new terminal in Ubuntu

Rpj
  • 5,348
  • 16
  • 62
  • 122

2 Answers2

1

posting this answer for future reference and help.

1st run the following command in the bash.

nvm alias default <the default version you want to set>

then put this in your .bashrc

export NVM_DIR="path/to/.nvm/folder" #<-edit with real value
if [ -s "$NVM_DIR/nvm.sh" ]; then
    source "$NVM_DIR/nvm.sh"
fi
NODE_DEFAULT_VERSION=$(<"$NVM_DIR/alias/default")
export PATH="$NVM_DIR/versions/node/$NODE_DEFAULT_VERSION/bin":$PATH

and, source .bashrc

the advantage of this setup is that, whatever node you will install and set as default, it will be available for all bash sessions.

isnvi23h4
  • 1,910
  • 1
  • 27
  • 45
0

You could put this in your ~/.bashrc:

nvm use 0.10.0
robertklep
  • 198,204
  • 35
  • 394
  • 381
  • which nvm doesn't show anything nvm use 0.10.0 (sets it, but if I add in .bashrc it says command not found) Now using node v0.10.0 – Rpj Apr 01 '13 at 03:15