DEV Community

Cover image for Node.js Management With NVM
serhatbek
serhatbek

Posted on

Node.js Management With NVM

If you ever find yourself juggling different versions of Node.js for various projects, I highly recommend using NVM (Node Version Manager). It's a simple tool that makes switching between Node.js versions super easy. Whether you're working on older projects or testing new features, NVM lets you manage multiple versions without any hassle. It’s been a real lifesaver for me. For installation and more detail check nvm repo.

With just a few commands, you can install, switch, or list Node.js versions. For example:

Check current version.
nvm version
Enter fullscreen mode Exit fullscreen mode
List installed node versions.
nvm ls
Enter fullscreen mode Exit fullscreen mode

or

nvm list
Enter fullscreen mode Exit fullscreen mode
Install LTS version.
nvm install lts
Enter fullscreen mode Exit fullscreen mode
Install specific version.
nvm install <version>
Enter fullscreen mode Exit fullscreen mode

Like:

nvm install 18.05.0
Enter fullscreen mode Exit fullscreen mode
Switch between installed node versions.
nvm use <version>
Enter fullscreen mode Exit fullscreen mode

Like:

nvm use 18.05.0
Enter fullscreen mode Exit fullscreen mode
Uninstall specific version (after switching to another version).
nvm uninstall <version>
Enter fullscreen mode Exit fullscreen mode
Create .nvmrc file with current node version in your project so you won't forget project's node version.
node --version > .nvmrc
Enter fullscreen mode Exit fullscreen mode

We've just made a simple introduction to NVM. Don't forget to check NVM repo for more detail.

Thank you for reading. If you find the article useful, please do not forget to like and comment so that others can access it. If you’re on a generous day, you can even buy me a coffee. πŸ™ƒ

Buy Me A Coffee

Top comments (1)

Collapse
 
harshthedev profile image
Harsh Singh

I built a task runner with a built-in Node version manager. It is written in Rust and does the job.

dev.to/harshthedev/shuru-a-simple-...