DEV Community

loading...

Discussion on: Managing multiple NodeJS versions

Collapse
stereoplegic profile image
Mike Bybee • Edited

A few extra pointers:

  • Homebrew for Mac or Linux is the easiest way to install NVM (brew install nvm), and it's one less separate update to manage (just update it with the rest of your brew packages).
  • Contrary to popular belief, it's entirely possible to use NVM as well as a "system" version of Node installed elsewhere (e.g. via brew install node@[version] on Mac and Linux, or from your Linux distro's repository, or from the official NodeSource deb or rpm repo). For everyday use, set NVM to use this version with nvm use system. The benefit of this is not having to redo your global node_modules for every new point release (and not needing to worry about either uninstalling previous ones or having several stale node_modules folders), as well as not needing to install yarn (e.g. via Homebrew) only to follow up by removing the Node it pulls down as a dependency. From there, when you need a specific NVM-provided version of Node, just do nvm use [version] or, even better, specify it in your project with a .nvmrc file.