Install Node.js on Linux
Required runtime for the three main AI coding tools.
Important
Claude Code, CodeX, and Gemini CLI all require Node.js 18+. If Node.js 18 or later is already installed, you can skip this page. Check with node -v.
Ubuntu/Debian
Use the NodeSource Repository (Recommended)
bash
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node --version
npm --versionCentOS/RHEL
bash
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs
# Verify installation
node --version
npm --versionFedora
bash
sudo dnf install -y nodejs npm
# Verify installation
node --version
npm --versionArch Linux
bash
sudo pacman -S nodejs npm
# Verify installation
node --version
npm --versionUse nvm (Recommended for Advanced Users)
nvm lets you manage multiple Node.js versions:
bash
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shell configuration
source ~/.bashrc
# Install Node.js LTS
nvm install --lts
# Set default version
nvm use --lts
nvm alias default nodeFAQ
Permission Issues
If you encounter permission problems, configure npm to use a user-level directory:
bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcNode.js Version Is Too Old
If your distribution-provided Node.js is too old, use the NodeSource repository or nvm to install the latest LTS version.
Next Steps
Environment Ready
You can now install Claude Code, CodeX, or Gemini CLI.