Studio stuck loading when running npm run dev - what am I doing wrong?

9 replies
Last updated: Oct 22, 2021
Good morning 👋 I’m a npm noob and think I’m launching my project the wrong way, I’ve been running
npm run dev
from the root directory of my project, but my Studio is stuck loading — any idea what I’m doing wrong?
AI Update

Good morning! 👋

The issue is likely that you need to run npm run dev from inside your Studio directory, not from the root of your project.

When you have a Sanity project, the Studio typically lives in its own folder (often called something like studio/, my-project-studio/, or similar). The sanity dev command needs to be run from the directory that contains your Studio's package.json and sanity.config.ts files.

Here's what you should do:

  1. Navigate to your Studio directory:

    cd studio  # or whatever your studio folder is called
  2. Then run the dev command:

    npm run dev

Your Studio should now start up properly and be available at http://localhost:3333 by default.

If you're working with a monorepo

If your project is set up as a monorepo (where multiple apps like your Studio and frontend live in the same repository), you might have a root package.json with scripts that can run commands in specific workspaces. In that case, check your root package.json for scripts like:

{
  "scripts": {
    "dev:studio": "pnpm --filter studio dev"
  }
}

But if you're just getting started and don't have that setup, the simple solution is to cd into your Studio directory first, then run npm run dev from there.

Hope that gets you unstuck! The sanity dev command is pretty fast once it's running from the right location with live reloading and all.

Show original thread
9 replies
This is what’s in my console
Did you cd into
studio
? and then type in
sanity start
user D
sorry, I’m a Terminal noob too 😬
user J
Seems like you don’t have the cli tools installed on this machine, maybe have a look at the first step in https://www.sanity.io/docs/getting-started to see if getting those installed will help?
user M
this did it, thank you so much!
Is the general process1. running
npm dev run
in the root folder, then2. running
sanity start
in the studio folder?or is there a different way I should be going about launching the project?

Also, how do I close everything? I usually just close the Terminal window but that feels like probably not the right thing to do
😬
Also I seem to have generated two blank files called
sanity
and
npm
which is probably a mistake on my part? 😆 Or are those important?
you can hit
ctrl-c
to stop the processes you start, but the effect will often be the same with closing the terminal.
I don’t know if you need to run
npm dev run
, it depends on what is in your
package.json
in that folder 🙂 It could be that it starts your frontend application?
the blank files sound like a mistake, yes
🙂 Again, its hard to tell you “you can delete them” from here, as I know nothing of what your application is or does, but you could for instance try to move them to a different folder, or rename them, and see if everything still works before deleting them. (Or if you use
git
for version control, you can ensure you have them in a commit you can roll back to if it ends up breaking something if they are deleted)
Also,
user J
, in your particular setup, if you run
npm run dev
in your
/web
directory, it'll start your 11ty frontend. If you run
sanity start
in your
/studio
directory, it'll start your Sanity Studio.

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?