If you use Angular, React, or another framework or different versions of them, you will have suffered the need to change the version of Node in your system. But switching between Node environments for local development It’s not easy, and it usually slows down the work.
One day I discovered NVM, and my work was simplified and accelerated. But what is NVM?
In simple words: NVM is a version manager for node.js.
NVM is a tool that makes switching between existing versions of Node much easier. This is especially helpful when developers are working on various projects that have different versions of Node. Without NVM you’d have to continuously uninstall and reinstall node versions and their global packages to use the different versions.
NVM makes it possible to:
NVM is straightforward to set up, follow the next steps:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
or
$ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Running either of the above commands downloads an installation script and runs it:
To check that NVM is correctly installed, open a new terminal and type in:
$ nvm -version
If everything is right, you will get back the version of the NVM package manager installed:
If your system does not find NVM execute the following command:
$ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"I
#node #javascript #nvm #react #angular