beginner 5 minutes
How to Set Up Node.js on Linux
Install Node.js on Linux using NVM for easy version management. The recommended way to use Node.js.
Prerequisites
- Any Debian-based Linux distribution
- Terminal access
- curl or wget installed
1
Install NVM (Node Version Manager)
NVM lets you install and switch between multiple Node.js versions. Install it with:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
2
Reload Shell Configuration
Apply the changes to your current terminal:
source ~/.bashrc
3
Verify NVM Installation
Check that NVM is installed correctly:
nvm --version
4
Install Node.js LTS
Install the latest Long Term Support version of Node.js:
nvm install --lts
5
Verify Node.js Installation
Check that Node.js and npm are working:
node --version npm --version
6
Set Default Node Version
Make this version the default for new terminals:
nvm alias default node