Error running "dev" command in Sanity project
15 replies
Last updated: Jan 18, 2023
A
Hiya! Just started my project and i have this error:Error: Command "dev" is not available outside of a Sanity project context.
Run the command again within a Sanity project directory, where "sanity"
is installed as a dependency.
at CommandRunner.runCommand (~/Documents/GitHub/regi-khan/studio/node_modules/@sanity/cli/lib/_chunks/cli-0bbdf4ec.js
:17877:33701) at Object.runCli (~/Documents/GitHub/regi-khan/studio/node_modules/@sanity/cli/lib/_chunks/cli-0bbdf4ec.js
:17880:2456)
Don't understand, it defintely has sanity as a dependency....
Run the command again within a Sanity project directory, where "sanity"
is installed as a dependency.
at CommandRunner.runCommand (~/Documents/GitHub/regi-khan/studio/node_modules/@sanity/cli/lib/_chunks/cli-0bbdf4ec.js
:17877:33701) at Object.runCli (~/Documents/GitHub/regi-khan/studio/node_modules/@sanity/cli/lib/_chunks/cli-0bbdf4ec.js
:17880:2456)
Don't understand, it defintely has sanity as a dependency....
Jan 18, 2023, 8:39 PM
A
Hi
user M
! Yes indeed. So weird. Just checked and this only happens with the projects where i have sanity v3. Does that make sense?Jan 18, 2023, 8:46 PM
A
user M
Here is a screenshot, hope it helps.Thanks so much!!Jan 18, 2023, 8:48 PM
A
"version": "3.2.3"
Jan 18, 2023, 8:50 PM
A
I know :face_with_peeking_eye:
Jan 18, 2023, 8:50 PM
A
Yes, it looks like this:
Jan 18, 2023, 9:14 PM
A
{
"private": true,
"name": "blog-with-gatsby-studio",
"main": "package.json",
"author": "Sanity <<mailto:hello@sanity.io|hello@sanity.io>>",
"scripts": {
"start": "sanity start",
"build": "sanity build",
"dev": "sanity dev",
"format": "prettier-eslint --write \"**/*.js\" \"!node_modules/**\"",
"graphql-deploy": "sanity graphql deploy",
"lint": "eslint .",
"test": "sanity check"
},
"keywords": [
"sanity"
],
"dependencies": {
"@react-md/icon": "^5.1.3",
"@sanity/dashboard": "^3.1.1",
"@sanity/vision": "^3.2.4",
"npm5": "^5.0.0-beta.69",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.7.1",
"sanity": "^3.2.4",
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",
"styled-components": "^5.3.3"
},
"devDependencies": {
"@babel/core": "^7.20.7",
"@babel/eslint-parser": "^7.19.1",
"eslint": "^8.31.0"
}
}
Jan 18, 2023, 9:14 PM
A
I did that before, but what actually solved it is that i created a new sanity studio project and after running that, the rest runned okay
Jan 18, 2023, 9:35 PM
A
no idea what happened really
Jan 18, 2023, 9:35 PM
A
i know š was mega stressed. Happy that is solved now. Thanks for your help as well š have a good night!
Jan 18, 2023, 9:36 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.