Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

CLI Error - zsh: command not found

16 replies
Last updated: Jan 29, 2022
I am all of a sudden getting zsh: command not found: sanity when trying to work with the CLI. I uninstalled the CLI and reinstalled it, still no luck. Any help?
Jan 29, 2022, 3:56 PM
A quick unblocker is to run
npx @sanity/cli [COMMAND]
What do you get if you run

echo $PATH
?
Jan 29, 2022, 4:00 PM
When I run $PATH I get /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Jan 29, 2022, 4:01 PM
A quick unblocker is to run
npx @sanity/cli [COMMAND]
What do you get if you run

echo $PATH
?
Jan 29, 2022, 4:00 PM
And
npm get prefix -g
?
Jan 29, 2022, 4:09 PM
I get /Users/zachtutor/.npm-global
Jan 29, 2022, 4:12 PM
Should I delete npm and start all over again?
Jan 29, 2022, 4:19 PM
Yeah, there seems to be something going on. I’d recommend checking out https://github.com/nvm-sh/nvm
Jan 29, 2022, 4:21 PM
Ok, so I completely uninstalled node and then reinstalled it and i'm still getting the same issue after trying to install sanity CLI... I can't do anything without using npx
Jan 29, 2022, 4:41 PM
Does other global commands work?
Jan 29, 2022, 4:49 PM
No, I've done something somewhere wrong, nothing is working now 😬😬
Jan 29, 2022, 4:55 PM
This sometimes happens 😕 What happens now when you run commands?
Jan 29, 2022, 5:35 PM
Lots of errors, sanity cli won't even install.... I was having issues in other places than just sanity cli yesterday. Not sure what to do
Jan 29, 2022, 6:04 PM
What does the errors say?
Jan 29, 2022, 6:05 PM
So, I got really frustrated because a lot of other errors were happening and so I just totally wiped my computer and started fresh entirely. Everything works now! A little drastic, but it was driving me crazy
Jan 29, 2022, 7:42 PM
😅 I’m glad it’s working again
Jan 29, 2022, 7:46 PM
Thanks for all your help!
Jan 29, 2022, 7:50 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?