Skip to content

Install Node.js on Linux ​

There are a lot of Linux distros. Here are the three setups that cover most of them: Ubuntu/Debian, Fedora/RHEL and Arch.

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

Fedora / RHEL ​

bash
sudo dnf install -y nodejs npm

Arch Linux ​

bash
sudo pacman -S --noconfirm nodejs npm

Troubleshooting ​

1) Permission errors on npm global installs ​

Don't reach for sudo npm -g every time. The more robust fix is nvm, which manages Node versions and the global package directory for you.

2) npm downloads are slow (optional) ​

If npm downloads crawl on your network, you can switch to a mirror registry (and switch back any time):

bash
npm config set registry https://registry.npmmirror.com

Check that it took effect:

bash
npm config get registry

One base URL for GPT, Claude and Gemini