Claude installed and worked once but then will not run again.
Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 6 comments · opened Feb 27, 2025 · closed Mar 7, 2025
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
I was able to get in once and went through the sign-up and purchased credits. I ran it in a directory and it worked. I then quit and tried again to run in a different directory and claude was not recongnized.
npm install @anthropic-ai/claude-code
added 3 packages, and audited 11 packages in 386ms
2 packages are looking for funding
run npm fund for details
found 0 vulnerabilities
claude
claude: command not found
I have tried removing and installing again and it does not change. Rebooting doesn't help either.
Ubuntu 24.04.2
6 Comments
I think you might be missing the -g flag:
npm install -g @anthropic-ai/claude-codeNo still the same problem but it does run if I execute this command (suggested by Claude)
npx @anthropic-ai/claude-code
Do you get any errors when installing it with the -g flag?
What does
npm prefix -gsay?Does you PATH
echo $PATHinclude the bin directory of the global prefix?I added the npm prefix -g /bin directory to my path and it works correctly now. Not sure if this was my mistake or a mistake of the installation. I was not able to remove and add with the -g option.
Glad it's working for you!
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.