Monday, May 11, 2020

change node and npm version in ubuntu


How To Switch Node And NPM Version

 
For Example you have already Installed node 12.0.1 version, and now you need different version of node ex: 14.1.0
 
 
What is NVM ?
 
NVM stands for (Node Version Manager).  it helps you manage and switch between different Node versions with easy . It provides a CLI interface where you can install different versions with a single command, and also set a default node version.


Step 1) Run below wget command on your terminal (it will download NVM bash script )

$  wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash

Step 2) source ~/.bashrc

Step 3) Install your desired version of node Ex:
14.1.0
 
$ nvm install 14.1.0

Step 4) Check the version.
 
$ node -v


Change NPM version

Step 1)
Install your desired version of NPM Ex: 6.3.0
 
$  npm install -g npm@6.3.0
 
Step 2) Check the version. 
 
$ npm -v
 
 
Set Default version of Node
 
  • Node all version installation directory path
 
/home/$USER/.nvm/versions/node
 
  • Check all installed version of Node
 
$ nvm list
 
  • Set Node Version Temporary (it will set only on current tab)

$ nvm use v14.1.0

  • Set Node Version Permanent (it will set for every tab)
$  nvm alias default v15.10.1 
 
 
 
 
 
 

No comments:

Post a Comment

testing