How to Set a Default Node.js Version Using NVM

Learn how to easily set a default Node.js version using Node Version Manager (NVM). Follow our step-by-step guide to ensure your preferred version is always ready when you start a new terminal session

If you work with multiple Node.js projects, each needing different versions, Node Version Manager (NVM) is a lifesaver. With NVM, you can switch between Node.js versions effortlessly. Here’s a quick guide on setting a default version, so your environment is ready whenever you start a new terminal session.

To set a default Node.js version, use the nvm alias default command. This allows you to select a specific version or the latest stable version as your default.

For example:

nvm alias default 16.14.2

Setting a default Node.js version helps maintain consistency across projects and keeps you in control of your development environment.