Installing node using nvm in Manjaro linux
Overview
nvm stands for Node Version Manager. It allows you to download and install different versions of Node.js. If in case you want to install and maintain multiple versions of Node.js in your system, this is the most preferred way of doing it.
Installation steps
- Step 1:
If this is the first time you are installing nodejs in your Linux, you can skip this step and move to step 2.
Remove previously installed node related packages like this:
sudo pacman -Rns nodejs npmIt might give you list of packages dependent on nodejs and npm. Make a note of all the packages you are choosing to remove. We can install them later.
- Step 2:
Now we need to download and install nvm package which is the most recommended way of installing nodejs as of now. nvm is currently present and is maintained in AUR.
Use one of the AUR Helpers to install nvm. Currently I am using yay AUR Helper. Use the following command to install nvm using yay:
yay -S nvmYou will be presented with a list of options, just go with the default ones if you are not sure.
- Step 3:
You will notice that the shell will not be able to find nvm command after the installation. For this command to work, you will have to source /usr/share/nvm/init-nvm.sh.
- Step 4:
At this stage, we have working nvm in our system. You can install latest version of node using following command:
nvm install node
nvm use nodeTo install any other version replace node in above mentioned command with that particular version like this:
nvm install 8.0.0Conclusion
Version manager like nvm makes it really easy for developer to work with multiple versions of node which otherwise would be nightmare to handle.
Comments
Post a Comment