Javascript, Web DevelopmentInstalling nodejs on CentOS 7 with NVM

Installing nodejs on CentOS 7 with NVM

Using NVM(Node Version Manager) we can have multiple nodejs versions and switch between them quickly.
I am doing this on CentOS 7.

# install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

# open a new terminal and check the version
nvm --version

# install latest node LTS and check version
nvm install --lts
node --version
npm --version

# install another node version
nvm install 8.12.0

# show all versions
nvm ls

# output
-> v8.12.0
v10.13.0
default -> lts/* (-> v10.13.0)
node -> stable (-> v10.13.0) (default)
stable -> 10.13 (-> v10.13.0) (default)
iojs -> N/A (default)
lts/* -> lts/dubnium (-> v10.13.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.14.4 (-> N/A)
lts/carbon -> v8.12.0
lts/dubnium -> v10.13.0

# -> (arrow) means that is the active version for the current shell
# (default) means, for any new shell you open, that will be the version used
# always check the node version in your shells

# to set an active version
# then issue nvm ls to see the arrow(->) move to the required version
nvm use 10.13.0
nvm ls

# to change default node version
nvm alias default 10.13.0

# additional tools for building
sudo yum install gcc-c++ make

Categories: Javascript, Web Development Tags: ,

Comments

No Comments Yet. Be the first?

Post a comment

Your email address will not be published. Required fields are marked *