Claude Code 1.0.xInstall

Claude Code: "claude: command not found" after npm install -g

claude: command not found
Affected versions
1.0.x
Fixed in
Last verified
Claude Code 1.0.x

Root cause

The global npm bin directory is not on PATH, or the install was run with sudo and created a root-owned/wrong symlink — so the shell can't find the `claude` binary.

How to reproduce

Run `npm install -g @anthropic-ai/claude-code`, then `claude` returns command not found.

Solutions (2)

Ordered by community votes. Always check the verified version before applying.

58
#1OfficialApplies to 1.0.x

Don't install with sudo. Use the official installer instead: `curl -fsSL https://claude.ai/install.sh | bash`, which avoids root-owned global npm issues.

Last verified: Claude Code 1.0.x · maintainer

33
#2Applies to 1.0.x

Add the npm global bin to PATH: run `npm config get prefix`, then add `<prefix>/bin` to your shell profile (.zshrc/.bashrc) and restart the shell.

Last verified: Claude Code 1.0.x · community

Source

Related errors