✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Error when running `sanity deploy` after upgrading project versions

7 replies
Last updated: Apr 1, 2024
Hey everyone! I just upgraded a project of mine from v2 and v3 and everything is working locally and the build is previewing locally as well. However, when I run
sanity deploy
, i'm getting the following error:
Error: sanity.cli.js does not contain a project identifier ("api.projectId"), which is required for the Sanity CLI to communicate with the Sanity API
Even though there is a
in the root of the directory that looks like this:
import { defineCliConfig } from "sanity/cli"

export default defineCliConfig({
	api: {
		projectId: "my_project_id",
		dataset: "production",
Anyone else hit this when upgrading? I also am getting a message in the terminal that I installed the nodes on the intel chip versus my m1 even though I've deleted my
and re-run
npm i
. Don't know if they are connected. Thanks in advance for and help!
Apr 1, 2024, 4:56 PM
What version of the CLI is used when you run
sanity --version
Apr 1, 2024, 5:00 PM
Hey Geoff! Thanks for the response. I'm using 3.11.5
Apr 1, 2024, 5:04 PM
Could you please try running
npx sanity deploy
, which will ask to download and then use the latest version (without impacting the version you have installed)?
Apr 1, 2024, 5:08 PM
That seemed to do the trick, but did not ask to download anything. Thank you for your help!
Apr 1, 2024, 5:10 PM
Great! In that case, it’s possible there was a change in there somewhere, and upgrading your global install of the CLI (
npm i -g @sanity/cli
) should let you run
sanity deploy
without getting that error.
Apr 1, 2024, 5:12 PM
Thanks Geoff! Have a great day
Apr 1, 2024, 5:13 PM
You too! 🙌
Apr 1, 2024, 5:15 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.

Was this answer helpful?