Issue with "sanity.json" file not found in plugin "@sanity/vision"

5 replies
Last updated: Jan 13, 2023
Hey all, I'm trying to start a new monorepo with next, and when trying to run sanity start for the first time I'm getting the following, even though I have a sanity.json file. How can I fix this?

Error: No "sanity.json" file found in plugin "@sanity/vision"
AI Update

This error is happening because you're mixing Sanity Studio v2 and v3 dependencies in your monorepo. The @sanity/vision plugin you have installed is the newer v3 version, but something in your setup is trying to run it with Studio v2 commands or dependencies that expect the old sanity.json configuration file.

Here's what's happening: Sanity Studio v3 completely removed sanity.json in favor of JavaScript/TypeScript configuration files (sanity.config.js or sanity.config.ts). The v3 vision plugin doesn't have a sanity.json file because it doesn't need one - but your setup is looking for it.

How to fix it:

Option 1: Use Studio v3 (recommended)

Make sure you're fully on Studio v3:

  1. Check your package.json - you should have "sanity": "^3.x.x" (not separate @sanity/core, @sanity/base, etc.)
  2. Delete your sanity.json file if it exists
  3. Create a sanity.config.ts (or .js) file in your Studio directory:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {visionTool} from '@sanity/vision'

export default defineConfig({
  name: 'default',
  title: 'My Project',
  
  projectId: 'your-project-id',
  dataset: 'production',
  
  plugins: [
    structureTool(),
    visionTool(),
  ],
  
  schema: {
    types: [/* your schema types */],
  },
})
  1. Use npm run dev or sanity dev instead of sanity start

Option 2: Use Studio v2 (not recommended - it's deprecated)

If you need to stay on v2 for some reason:

  1. Downgrade vision to v2: npm install @sanity/vision@^2
  2. Keep your sanity.json file
  3. Use sanity start

The v2 to v3 migration is straightforward for most projects. Check out the official migration guide for a complete walkthrough. In a monorepo setup, make sure all your Sanity dependencies are aligned to the same major version across packages.

Hey User, I’ve had a similar issue. I think I resolved mine by checking if the major version of
@sanity/vision
plugin and
sanity
were matching.
You mean @sanity/base right?
    "@sanity/base": "^2.35.2",
    "@sanity/core": "^2.35.0",
    "@sanity/default-layout": "^2.35.2",
    "@sanity/default-login": "^2.35.2",
    "@sanity/desk-tool": "^2.35.2",
    "@sanity/eslint-config-studio": "^2.0.1",
    "@sanity/vision": "^3.2.3",
Yeah, I think the issue here is that you have
@sanity/vision
=> 3.x, downgrade the vision plugin and it should work properly.
That worked!! thanks mate

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?