Skip to content

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

bash
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

# Verify installation
node --version
npm --version

CentOS/RHEL

bash
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs

# Verify installation
node --version
npm --version

Fedora

bash
sudo dnf install -y nodejs npm

# Verify installation
node --version
npm --version

Arch Linux

bash
sudo pacman -S nodejs npm

# Verify installation
node --version
npm --version

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 node

Troubleshooting

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 ~/.bashrc

Outdated 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.

Harmony, Kindness, Mutual Help, Happiness