Node.js Development Setup
We'll install a recent version of Node.js using nvm (Node Version Manager), which is a Node.js version manager for Unix-like/POSIX systems such as Linux and macOS.
info
For other options and systems (e.g., Windows), please refer to the official Node.js Download page.
-
Install nvm using Git:
cd ~/
git clone https://github.com/nvm-sh/nvm.git .nvm
cd ~/.nvm
git checkout v0.40.3 -
Add the following at the end of your
~/.bashrc
:###
# nvm
# source: https://github.com/nvm-sh/nvm#git-install
###
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion -
Restart your terminal. Verify nvm works (should print something like
0.39.7
):nvm -v
-
Install the latest Node.js 20:
nvm install 20.*
-
Verify Node.js is installed and active (should print something like
v20.19.2
):node -v
-
Upgrade the bundled npm:
npm --global install npm
-
Check the installed npm version:
npm -v
That's all!