
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeIt sounds like you're running into a common issue when installing Sanity in an existing project folder. Since you mentioned it's a "different error about something missing," there are a few likely scenarios:
Most Common Issue: Missing Dependencies
After running sanity init in your project folder, you need to actually install the dependencies. The init command creates the configuration files but doesn't always automatically install packages. Try running:
npm install
# or if you use yarn
yarn install
# or if you use pnpm
pnpm installIf You're Working with React or Next.js
If you initialized Sanity inside an existing React/Next.js project, you might be missing the core Sanity packages. Make sure these are installed:
npm install sanity @sanity/visionCheck for Version Conflicts
Sometimes you'll get errors about missing peer dependencies or version mismatches, especially with @sanity/ui. The missing context error documentation explains that multiple versions of the sanity package can cause issues. Try:
npm list sanityIf you see multiple versions, you may need to clean your node_modules and reinstall:
rm -rf node_modules package-lock.json
npm installStarting Fresh in the Right Order
For future reference, the correct sequence when getting started with the Sanity CLI is:
npm install -g sanity@latestsanity init in your project foldernpm install to install all dependenciesnpm run dev or sanity devIf you can share the specific error message you're seeing, I can give you more targeted help! Common error messages include "Cannot find module 'sanity'", "Missing peer dependency", or "Command not found: sanity".
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store