🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Discussion on deleting and reinstalling Sanity CLI package and resolving related issues.

7 replies
Last updated: Jul 26, 2022
How do I delete Sanity? I will reinstall it again right away, as I think it'll be much easier with the issues I am having. However, it's saying either, "A valid session is required at this endpoint" or "Cannot delete user while being the last administrator of a project".  The error I am getting from a project I was getting was" Error: Command "start" is not available outside of a Sanity project context.
Run the command again within a Sanity project directory, where "@sanity/core"
is installed as a dependency.
    at _.runCommand (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:3608:1340)
    at t.exports (/usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js:1980:2422)
Jul 18, 2022, 1:59 AM
I guess it would involve uninstall the Sanity CLI package you installed globally. Unless you meant closing your Sanity account?
Jul 18, 2022, 7:49 AM
It took me a bit, being new to this as well, but once you install sanity/cli, you will then be able to create a sanity project. You'll do that running sanity init. That process will create the end path where your sanity project will live. As a starter, I suggest you make your final path /studio. That directory will be a sanity project. Most of the commands you'll need to run will only work in that directory, so you will first have to cd to it (cd studio). Immediately run sanity --help to see the commands. For example, you can't run sanity uninstall unless you are in that folder first.
I may not be totally right on this but I had unintentionally installed version 3 of the sanity cli. It may be great, but as a beginner I was trying to get a handle on v2. They are significantly different. So, I first uninstalled my global installation of v3. I then installed v2 globally.

I then found I could install v3 locally in the folder I was working my main web project on. I found that both were present, so I had to be careful to give my v2 commands as simple sanity <something>, as opposed to npx sanity <something> for v3.

After installing the cli, you most likely would be running sanity start, but make sure you first cd into the sanity project folder. If you didn't change the final path to /studio, you should pay attention to the name it is given during the init process.

Best of luck.
Jul 19, 2022, 11:41 PM
I don't see an option to close my account. I searched for it on its site. And there are just too many sanity folders on my computer to determine which one to delete and of course, it's not uninstalling if I am just trashing sanity. Of course, if I don't have to delete my account or uninstall, much better. But that may require me more time to figure out. I have other sanity projects btw. I am ok with deleting them also just to be able to start fresh.
Jul 21, 2022, 1:59 AM
Ray, I figured you know how to go through all these folders to determine where to even start uninstalling sanity?
Jul 21, 2022, 2:11 AM
I figured it out. I searched for all my previous sanity projects and deleted all of them. It's ok. It turned out they were all unfinished projects. This was the easiest for me to figure out. The only problem I encountered was the duplication. I put it in my folder with subfolder of d-portfolio. When I was prompted to give a Project Name, I wrote down d-portfolio. So Development/d-portfolio/d-portfolio for me to able to use sanity start. But at least it worked finally. Thanks
Jul 21, 2022, 2:53 AM
Wonderful you were able to solve your problem
user V
!

user N
you can also get a specific version installed without uninstalling the excisting one:
npm install <package>@<version>
or
yarn add <package>@<version>
Example:

yarn add @sanityt/cli@*2.30.2*
Jul 26, 2022, 10:41 AM
Thanks. The problem I was having was that I unintentionally upgraded my 2.30.2 global install to the version 3. Once that is done, could I still have done a local installation of 2.30.2?
Jul 26, 2022, 1:17 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?