Watch a live product demo 👀 See how Sanity powers richer commerce experiences

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

The Sanity Composable Content Cloud is the 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.

Categorized in

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
After adding the subtitle and running this code npm run graphql-deploy It does nothingSep 15, 2020
how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array...Sep 18, 2020
Is it possible to fetch more than one "_type" using GROQ?Nov 2, 2020
I want to add a view with the Structure builder (S.view.component) where I list similar documents based on the title. What...Sep 23, 2020
Is there a structure builder example where the format of each preview for the document list is modified?Feb 3, 2021
I have an array of references to a country schema type but it always just returns NULL values for meJan 30, 2021
Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref...Dec 1, 2020
Sanity UI looks brilliant :smiley: Is something like the current date picker possible at the moment? I’m not sure if anicon...Dec 21, 2020
Hey everyone. I have been coding and may have potentially accidentally deleted something. Does anyone know how to resolve...Dec 26, 2020
Hello everyone and happy new year :raised_hands::skin-tone-2:, I have a problem with outputting Portable Text :disappointed:...Jan 1, 2021

Related contributions

Clean Next.js + Sanity app
- Template

Official(made by Sanity team)

A clean example of Next.js with embedded Sanity ready for recomposition.

Cody Olsen
Go to Clean Next.js + Sanity app

Blog with Built-in Content Editing
- Template

Official(made by Sanity team)

A Sanity-powered blog with built-in content editing and instant previews.

Go to Blog with Built-in Content Editing