How to set the default version of nodejs in a linux terminal

If you are fed up of having to set the default nodejs version in each terminal tab, then this post is for you. Hopefully you installed node using nvm. Use the following command to set your node version

# list the versions of node you have installed
nvm ls

# Install a particular version
nvm install 8.10.0

# Set version 8.10.0 as default
nvm alias default 8.10.0

Hereafer any new termial session will be initialized with the node version that you specified.

If you want to use a different version of node in particular terminal session, you can always do something like

# If you want switch to using 6.1.0 in your current terminal tab
nvm use 6.1.0

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...