Installing Node.js – The Best Way

Colby Hemond
The best way to install node is using a version manager. Specifically nvm (Node Version Manager).
What's included in this article:
- Checking versions
- Installing
nvm - Installing
node - Changing versions
- Why is installing node using
nvmthe best way?
Checking versions
In order to check your versions you must have a terminal/command prompt/command line window open. You can accomplish this by searching for the application on your computer. Or if you have a code editor installed, you usually can open one within the editor.
Node Version Manager
command -v nvmIf nvm is installed, the next line should show nvm.
Node.js
node -vIf you have node installed, it will show you a version number. If no version number is shown, then node is not installed.
NPM
npm -vIf npm is installed, it will show you a version number. If no version number is shown, then npm (and node) is not installed. These two come hand-in-hand—installing node will install npm.
Installing nvm on macOS/Linux
If you followed the last section and tried checking your versions, you should have a terminal window still open. If not, open one.
At the top of your terminal, it should tell you what type of shell it's using: bash, sh, or zsh.
If you're still unsure, type:
psThat should list a few lines in which you should see your shell.
Install commands
For bash:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashFor sh:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | sh
For zsh:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zshIf everything installed correctly, verify with:
command -v nvmThe terminal should output nvm. If it doesn’t, try restarting your terminal and checking again.
Installing Node
Make sure nvm is installed:
command -v nvmIf it shows nvm, you're good to proceed. If not, install nvm before continuing.
Usually it's best to install the recommended LTS (Long-Term Support) version. You can check that on the Node.js website.
At the time of this writing:
- Recommended version:
16.15.1 - Latest version:
18.3.0
To install Node v16 (LTS):
nvm install 16Once that finishes, Node 16 will be installed. 🎉
Changing Versions
To change Node versions, just install the version you want to use:
nvm install 14nvm install 18nvm will automatically switch to the version you install, but you can also switch manually with:
nvm use 14Why is nvm the best way to install Node?
Installing Node with nvm lets you:
- Easily switch between versions
- Avoid using
sudofor global packages - Keep your environment clean and flexible
Other install methods:
- Downloading binaries from the website
- Using your system's package manager
Those often require admin privileges or cause conflicts when switching projects. nvm solves all that with minimal setup and maximum convenience.
We're all about making life easier—and this is the way to do it.