Setup Node Environment

September 6, 2023 by Lingxi

It is highly recommended (will be required very soon) to use Node version 22 or above. You can check your version by executing node --version in your terminal. If you find out that you are using a version less than 22, then this guide is for you.

Preparation

Checklist

  • Your terminal. Please get yourself used to access your terminal. This will be the most common tool to use during the development.
  • NVM. Check https://github.com/nvm-sh/nvm for installation guide or below for macOS homebrew guide.

On macOS, Homebrew is recommended when installing NVM or any other CLI tools. Once you have Homebrew ready on your machine, you can simply use the following one-line command to install NVM. Very simple and easy.

Bash

brew install nvm

Use NVM

For instance, to install Node version 22 (latest minor version with major version 22), you can do something like:

Bash

nvm install 22

To use node version 22 after installation (or when you are starting a new terminal window and your default version is less than 22), run the following command with your version (22 in this case):

Bash

nvm use 22

Very simple and easy!

To set the default version of Node that will be used when you start the terminal, you can use the following command:

Bash

nvm alias default 22

You can always check NVM documentation for more information.

© 2025 Lingxi Li.

SF