Sanity CLI not working on M1 Mac with Gatsby blog starter
I've run into similar issues upgrading older Sanity projects on M1 Macs! The good news is this is almost always a Node.js version mismatch rather than an M1-specific problem.
Here's what's likely happening: Your old Gatsby blog starter was probably using Sanity Studio v3, which required Node.js 18. However, if you're upgrading dependencies to current versions, you need to know that Sanity Studio v4 now requires Node.js 20 or higher. This change happened because Node.js 18 reached end-of-life in April 2024.
Quick fix steps:
Check your Node version: Run
node -vin your terminal. If you're on anything below Node 20, that's your issue.Upgrade to Node 20+: I'd recommend using a version manager like
nvm(Node Version Manager) since you're working with an older project that might need different Node versions:nvm install 20 nvm use 20Reinstall dependencies: After switching Node versions:
rm -rf node_modules package-lock.json npm installReinstall the Sanity CLI globally (if you have it installed globally):
npm install -g @sanity/cli
The M1 Mac itself should work fine with Sanity CLI - Apple Silicon has been well-supported for a while now. The issue is almost certainly the Node version compatibility.
If you're still having issues after upgrading Node, check that your PATH environment variable is properly configured so node -v and npm -v work from the command line. Sometimes on M1 Macs, if you've installed Node through different methods (Homebrew, nvm, direct installer), there can be PATH conflicts.
Good luck with resurrecting that project!
Show original thread28 replies
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.