Install Node.js on Linux
The required runtime environment for the three major AI coding tools.
Important
Claude Code and Codex CLI both require Node.js 18+. If Node.js 18 or later is already installed, you can skip this section.
Verification command: node -v
Ubuntu/Debian
NodeSource Repository (Recommended)
sh
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
sh
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs
# Verify installation
node --version
npm --versionFedora
sh
sudo dnf install -y nodejs npm
# Verify installation
node --version
npm --versionArch Linux
sh
sudo pacman -S nodejs npm
# Verify installation
node --version
npm --versionUse nvm (Recommended for Advanced Users)
nvm lets you manage multiple Node.js versions:
sh
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shell config
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 issues, configure npm to use a user directory:
sh
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcVersion is too old
If the Node.js version provided by your system is too old, use the NodeSource repository or nvm to install the latest LTS version.
Next Steps
✅ Environment ready!
You can now continue installing Claude Code, Codex CLI, Codex Desktop, or OpenCode.