Runtime
A runtime environment is where your code scripts are executed and dependencies are installed. You should limit yourself to a single runtime to reduce the complexity of setting up your development environment.
Solution: Node.js
Node.js is the most popular runtime for frontend development. It is a JavaScript runtime built on Chrome’s V8 JavaScript engine that allows you to run JavaScript code outside of a browser.
Install and manage your Node.js version
I recommend using Node Version Manager (nvm) to install and manage your local Node.js version. You can install it following the instructions on the nvm GitHub repository.
To download, compile, and install the latest release of Node.js:
nvm install node # "node" is an alias for the latest version
To install the latest LTS version of Node.js:
nvm install --lts
To install and use a specific version of Node.js:
nvm install 22.13.1
Specifying the Node.js version in your project
I recommend specifying the Node.js version in your project’s package.json
file. This will ensure that the correct version of Node.js is used when installing and running your project both locally, in CI/CD pipelines as well as hosted environments:
{ ... "engines": { "node": "22.x" }}
I do not recommend using a .nvmrc
file to specify your Node.js version, simply because you should always prefer a single source of truth and the engines
field in your package.json
has wider support.