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?

Node Version Manager

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:

  • To have multiple projects whose libraries need to be building against different versions.
  • If you’re building an app, NVM gives you a way to get around the hurdles that can come with each update.
  • You can quickly test how your application behaves with different Node versions.
  • Download any remote versions of Node locally with a simple command.
  • It makes it easy to test applications with different JavaScript levels.
  • NVM works with multiple types of shells.

Install NVM

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:

Image for post

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:

Image for post

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

NVM: A must-know tool for front-end developers
1.50 GEEK