Install Node.js on Linux
Essential runtime for AI coding tools
Important
Claude Code and CodeX require Node.js 18+ runtime. If you already have Node.js 18 or later installed, you can skip this section. Verify with: node -v
Ubuntu/Debian
Using 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 --versionUsing 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 nodeTroubleshooting
Permission Issues
If you encounter permission issues, configure npm to use a user directory:
bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrcOutdated Version
If the system-bundled Node.js version is too old, use the NodeSource repository or nvm to install the latest LTS version.
Next Steps
Environment setup complete! You can now proceed to install Claude Code or CodeX.