Sanity installation error: something missing after installing in project folder
It 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:
- Install the Sanity CLI globally (if you haven't):
npm install -g sanity@latest - Run
sanity initin your project folder - Run
npm installto install all dependencies - Start the development server:
npm run devorsanity dev
If 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".
Show original thread20 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.