Using NVM to manage Node versions

Eric Gregorich

As a developer who uses Node.js, you often find yourself needing to install a very specific version of Node.js that will work with the application your developing. Doing this repeating is exhausting.

NVM solves this problem by allowing you to install multiple versions of Node.js onto your machine. You can then quickly switch the version your using as needed by running a single simple command.

Why do you need multiple versions of Node.js?

If you work with different types of apps, you may have specific dependencies. For example, I had to pull code for an SPFx web part to package and deploy it. The application's dependencies required me to use a different version of Node.js than what I had installed.

Get NVM

NVM for MacOS - NVM for Windows

Common Commands

  • nvm list available - Get a list of available Node.js versions.
  • nvm list - Get a list of installed versions of Node.js.
  • nvm install {version number} -  to install a new version.
  • nvm uninstall {version number} - to uninstall a version.
  • nvm use {version number} - to switch to an installed version of Node.js.

References

Andrew Connell - Better Node.js Install Management with Node Version Manager
Many if not most traditional SharePoint developers are new to the dev stack and build tool chain Microsoft selected for SharePoint Framework development.