Error when running `sanity deploy` after upgrading project versions
This is a known issue that comes up after upgrading from Sanity v2 to v3! The problem is usually related to using an outdated global version of the Sanity CLI, even though your project configuration is correct.
Based on this community thread, the quickest solution is to run:
npx sanity deployThis uses the latest version of the CLI without affecting your globally installed version. If that works (which it should), you can permanently fix the issue by updating your global CLI installation:
npm install --global sanity@latestThe issue occurs because older versions of the CLI (like 3.11.5 mentioned in the thread) don't properly read the new v3 configuration format in sanity.cli.js, even though the file is correctly structured. The CLI was updated to handle the ESM-based configuration files that Studio v3 uses.
Your sanity.cli.js file looks correct - it's using the proper defineCliConfig helper and has the required projectId and dataset fields. The problem is purely on the CLI side, not your configuration.
As for the Intel/M1 chip warning you're seeing - that's a separate issue related to npm installing binaries for the wrong architecture. It shouldn't affect the deploy error, but if you want to fix it, try:
rm -rf node_modules package-lock.json
npm installOne other thing to check: make sure your import statement in sanity.cli.js is exactly from "sanity/cli" (not /sanity/cli - note the leading slash). Some folks in the community thread mentioned that incorrect import path can also cause this error.
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.