Node.js

Node.js is the most popular runtime for executing JavaScript outside of a web browser. It allows you to build backend web servers, command-line tools, and backend scripts using the exact same JavaScript language you use on the frontend.

If you have used Python, you are familiar with running a script from your terminal:

python main.py

Similarly, once the Node.js toolchain is installed on your machine, you run JavaScript files directly from your terminal:

node main.js

Node Version Manager (NVM)

As your projects grow, you will often find that Project A requires Node v18, while Project B requires Node v22.

NVM (Node Version Manager) is the industry-standard tool used to seamlessly manage multiple installations of Node.js on a single computer.

With NVM installed, you can:

  • Quickly download new versions of Node (nvm install 22)
  • Switch between versions on the fly (nvm use 22)

The .nvmrc File

A best practice in Node development is placing a .nvmrc file in the root of your project directory. This file simply contains the specific version number of Node that your project requires (e.g., 22.14.0).

When another developer clones your repository, they simply type nvm use, and NVM will automatically read the .nvmrc file and activate the correct version.