Sanity installation error: something missing after installing in project folder

20 replies
Last updated: Nov 29, 2025
I just tried installing sanity inside of my project folder (I failed to do that before) and now I'm getting a different error about something missing.
AI Update

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 install

If 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/vision

Check 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 sanity

If you see multiple versions, you may need to clean your node_modules and reinstall:

rm -rf node_modules package-lock.json
npm install

Starting Fresh in the Right Order

For future reference, the correct sequence when getting started with the Sanity CLI is:

  1. Install the Sanity CLI globally (if you haven't): npm install -g sanity@latest
  2. Run sanity init in your project folder
  3. Run npm install to install all dependencies
  4. Start the development server: npm run dev or sanity 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 thread
20 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.

Was this answer helpful?