How Can The Default Node Version Be set using NVM?

Fix EBADENGINE errors by matching your Node.js version to the engines range in a module’s package.json. Use NVM to change Node version or safely disable the engine check if needed.

NVM (Node Version Manager) allows you to install and switch between multiple Node.js versions. Setting a Node.js default version means every time you open a new terminal session, the preferred Node version will be loaded.

Steps to Set Default Node Version:

List Installed Versions
nvm ls
Install Desired Node Version (if not already installed)
nvm install 22.17.1
Set It as Default
nvm alias default 22.17.1
This will set the specified version as the default. Every new terminal session will now use this version automatically.
Also Read: Node JS Test-Driven Development

Why Set a Default Version?

  • Consistency across projects
  • Avoid version conflicts
  • Simplify development and CI/CD

You can check the current version by running:

node -v

If you want to switch temporarily in a session, use:

nvm use 16
For team projects, consider using a .nvmrc file in the root directory with the preferred version. This will allow team members to sync easily by running:
nvm use

Conclusion

Set a default Node.js version using NVM to make life easier. Get the steps to lock your preferred version across terminal sessions.
Related

How to Get the Project Root Path in Node.js When working with large Node.js projects, you often need to find the root directory at runtime…

15 Oct, 2025

If you’re trying to run nodemon from the terminal and see the error: nodemon: command not found, it usually means the nodemon package is not…

10 Oct, 2025

Writing to files is a common task in Node.js, whether for logging, saving uploads or creating reports. Node.js has various methods through the built-in fs…

07 Oct, 2025