You need Node.js v18 or higher and npm.
fnm (Fast Node Manager) is officially recommended by Node.js. It's fast, lightweight, and lets you switch Node versions easily if needed later.
-
Open your browser and go to nodejs.org/en/download.
-
You'll see a row of dropdowns that says: "Get Node.js® vXX.XX.X (LTS) for __ using __ with __". Set the dropdowns as follows:
Dropdown Select Version vXX.XX.X (LTS) — keep the default LTS version, don't change it OS Linux Package Manager fnm (under "Recommended (Official)") Package Format npm — keep the default -
The page will show you the exact commands to run. Open your terminal and copy-paste them. They will look something like this:
# Step 1 — Install fnm curl -fsSL https://fnm.vercel.app/install | bash # Step 2 — Restart your terminal or reload your shell profile source ~/.bashrc # or: source ~/.zshrc (if you use zsh) # Step 3 — Install Node.js fnm install 24 # The page will show the exact version number
The version number may differ from above — always use whatever the website shows.
-
Close and reopen your terminal (or run the
sourcecommand above) so thatfnm,node, andnpmare available.
Why fnm? It's in the "Recommended (Official)" category on the Node.js download page. Like nvm, it installs Node into your home directory so you never need
sudofor npm global installs — but fnm is significantly faster (written in Rust) and works the same across Windows, macOS, and Linux.
This is quicker but may install an older version of Node.js. Check the version after installing — if it's below v18, use Option A instead.
Ubuntu / Debian:
sudo apt update
sudo apt install -y nodejs npm
# Check the version
node --version # Must be v18 or higherFedora:
sudo dnf install -y nodejs npmArch Linux:
sudo pacman -S nodejs npmFor Ubuntu/Debian users who want the latest LTS without using nvm:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejsnode --version
npm --versionBoth should print version numbers. node --version must show v18.x or higher.
npm install -g @anthropic-ai/claude-codePermission error?
- If you used fnm or nvm: this shouldn't happen. Check that it's active (
which nodeshould point to a path inside your home directory, not/usr/...).- If you used a system install: either use
sudo npm install -g @anthropic-ai/claude-codeor fix npm's global directory permissions:mkdir -p ~/.npm-global npm config set prefix '~/.npm-global' echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc source ~/.bashrc
claude --versionYou should see the Claude Code version printed. Now head back to README.md for authentication setup.
- WSL (Windows Subsystem for Linux): This guide works inside WSL too. Just follow these steps from your WSL terminal.
- PATH issues: If
claudeis not found after install, ensure npm's global bin is in your PATH. Runnpm config get prefix— thebin/subdirectory of that path needs to be in your PATH.