Jordan Smalls

Software Engineer

Installing NVM on macOS and Linux

NVM is the best way I've found to work with Node.js. It keeps Node versions out of the system installation and makes switching between projects painless.

Install NVM with its official script:

sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh | bash

Restart your terminal, then install the latest long-term support release:

sh
nvm install --lts
nvm use --lts

Confirm everything works:

sh
node --version
npm --version

For a project that needs a specific version, add it to an .nvmrc file and run nvm use from that directory. That's the whole setup.