Issue with running "sanity start" command in a project context
25 replies
Last updated: May 11, 2022
C
I'm having issues with running "sanity start" I am in the studio directory and I get the following error: 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.
is installed as a dependency.
May 11, 2022, 3:50 PM
Hey there! It may be worth it to try running
sanity installin the root of the directory once more. It's possible that it's listed as a dependency but not installed.
May 11, 2022, 6:17 PM
C
ok, i'll give it a shot now, thanks for replying
May 11, 2022, 6:19 PM
C
just did that and restarted vs code. Still same issue. So frustrating, I've been trying to search everywhere for a solution and nothing
May 11, 2022, 6:21 PM
C
also, it did work yesterday prior to me running npm run build
May 11, 2022, 6:22 PM
C
not sure if that did anything
May 11, 2022, 6:22 PM
It shouldn't. I've just tested it by running
What does your folder structure look like? Is it possible you're using a monorepo and you're not in the right directory?
npm run buildthen
sanity start. But to test, you can try deleting
distand
node_modulesand then reinstalling.
What does your folder structure look like? Is it possible you're using a monorepo and you're not in the right directory?
May 11, 2022, 6:26 PM
C
I've read about deleting dist and nod_modules, I haven't tried that yet.
May 11, 2022, 6:27 PM
C
I'm sure I'm in the right directory since I was able to use sanity start yesterday and for about a week.
May 11, 2022, 6:29 PM
C
but something must have went of of sync and I don't know what caused it
May 11, 2022, 6:29 PM
C
also when i ran npm run build i encounted an error so not sure if that messed things up
May 11, 2022, 6:33 PM
C
I don't remember the error and I restarted the program so it's not in my history.
I just removed node modules via
than reinstalled it.
I than ran sanity install and I still get the issue.
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 (C:/nvm/v16.13.2/node_modules/@sanity/cli/bin/sanity-cli.js
:3614:1340) at t.exports (C:/nvm/v16.13.2/node_modules/@sanity/cli/bin/sanity-cli.js
:1986:2422)
I just removed node modules via
rm -rf node_modules/ npm install
I than ran sanity install and I still get the issue.
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 (C:/nvm/v16.13.2/node_modules/@sanity/cli/bin/sanity-cli.js
:3614:1340) at t.exports (C:/nvm/v16.13.2/node_modules/@sanity/cli/bin/sanity-cli.js
:1986:2422)
May 11, 2022, 6:50 PM
C
I have 2 package.json files, One within the sanity project folder and the other in the Next.js folder
May 11, 2022, 7:03 PM
C
it shows that @sanity/core is in my package.json however it keeps showing that error when I run "sanity start"
May 11, 2022, 7:04 PM
It doesn't look like you're inside of a Studio directory. That looks like the structure of a Next project.
May 11, 2022, 7:08 PM
C
buzznextstudio is the sanity folder
May 11, 2022, 7:10 PM
C
I also noticed in the package.json within Studio project, "author": null, displays an error (Incorrect type. expected one of object, string
May 11, 2022, 7:11 PM
C
I meant buzznextsanity is the sanity folder I just pasted above
May 11, 2022, 7:12 PM
C
ok, I'll move it in the the sanity folder now
May 11, 2022, 7:13 PM
C
that's what my sanity.json file looks like.
May 11, 2022, 7:15 PM
C
I moved it into the buzznextsanity folder and I get this error
May 11, 2022, 7:17 PM
C
I downgraded to react 16.2 and still have the same error
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.
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.
May 11, 2022, 7:33 PM
C
and as shown in image above, @sanity/core 0.139.2 is the version
May 11, 2022, 7:34 PM
C
well, I sort of took a work around approach, I completely reinstalled from a backup and got it to work. I'm guessing it was something corrusted in the node modules
May 11, 2022, 9:37 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.