Sanity admin error after installing @sanity/vision plugin

11 replies
Last updated: Jan 19, 2024
I installed
sanity/vision
and the admin throws this error. Appreciate any help!sanity.config.ts


import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '<@UFY5PJF3M>/vision'
import {schemaTypes} from './schemas'

export default defineConfig({
  name: 'default',
  title: 'Next Sanity Project',

  projectId: 'blgwm78i',
  dataset: 'production',

  plugins: [deskTool(), visionTool()],

  schema: {
    types: schemaTypes,
  },
})
AI Update

I can see the issue in your code! In your import statement, you have:

import {visionTool} from '<@UFY5PJF3M>/vision'

That <@UFY5PJF3M> looks like a Slack user mention that got accidentally pasted in. The correct import should be:

import {visionTool} from '@sanity/vision'

Here's your corrected sanity.config.ts:

import {defineConfig} from 'sanity'
import {deskTool} from 'sanity/desk'
import {visionTool} from '@sanity/vision'
import {schemaTypes} from './schemas'

export default defineConfig({
  name: 'default',
  title: 'Next Sanity Project',

  projectId: 'blgwm78i',
  dataset: 'production',

  plugins: [deskTool(), visionTool()],

  schema: {
    types: schemaTypes,
  },
})

Note: If you're using a more recent version of Sanity Studio (v3.37.0+), you might also want to update from deskTool to the newer structureTool:

import {structureTool} from 'sanity/structure'
// ... 
plugins: [structureTool(), visionTool()],

The deskTool still works but has been renamed to structureTool in newer versions. Either will work fine for now!

Make sure you have @sanity/vision installed in your package.json. If you haven't installed it yet, run:

npm install @sanity/vision

That should resolve your error!

Show original thread
11 replies
Do you happen to remember which command you used to install the plugin? I think I remember this happening when people installed V2 in a V3 studio.
This one
npm install --save-exact @sanity/vision
  "dependencies": {
    "@portabletext/react": "^3.0.11",
    "@sanity/vision": "3.25.0",
    "next": "14.0.3",
    "next-sanity": "^7.0.1",
    "next-sanity-client": "^1.0.7",
    "react": "^18",
    "react-dom": "^18",
    "sanity": "^3.20.2"
  },
package.json
Can you try updating the Studio to the latest version?
This command?
npm install --global sanity@latest

Use this and it works!
npm install sanity@latest @sanity/vision@latest

Do both package versions need to match? Right now, they use
"^3.25.0"
Naw, they don’t need to be the same. I was thinking maybe there was a bug in the older version of the Studio that was causing it.
Gotcha. Thank you so much!
You’re welcome!

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?