✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Discussion about missing schema.js file in new Sanity V3 version and how to add schemas to index.js instead.

32 replies
Last updated: Dec 9, 2022
I've started multiple times from the tips on the sanity page which is to create a project like this but it still installs without a schema.js file:
npm create sanity@latest -- --template clean --create-project "Sanity Project" --dataset production

Dec 8, 2022, 6:36 PM
could you try with the blog template?
Dec 8, 2022, 6:38 PM
I'll try that and see if it works.
Dec 8, 2022, 6:41 PM
Thanks for tips btw.
Dec 8, 2022, 6:46 PM
Do you suggest using typescript if your going to use react,js?
Dec 8, 2022, 6:52 PM
with react? absolutely
Dec 8, 2022, 6:53 PM
with vue it is currently pretty weird using typescript
Dec 8, 2022, 6:53 PM
ok great because it asks more questions now when setting up sanity lol. I've heard of vue but never used it yet. My project was actully fine before the new update so it's little overwhelming for a newbie such as myself
Dec 8, 2022, 6:54 PM
I just ended up deleting everything and starting over.
Dec 8, 2022, 6:55 PM
did you end up getting the schema file?
Dec 8, 2022, 6:56 PM
if not, it is pretty easy to manually set up
Dec 8, 2022, 6:56 PM
also now i get a question that asks which package manager should i use to install dependencies. npm or manual and i have npm installed btw. I haven't finished the install yet because im not sure if i should use npm or install dependencies manually
Dec 8, 2022, 6:57 PM
use yarn
Dec 8, 2022, 6:57 PM
npm install -g yarn
Dec 8, 2022, 6:57 PM
it is several times faster and has some extra features
Dec 8, 2022, 6:58 PM
Ahh ok cool. the other day i had a yarn file but now when i install its gone. i had a yarn.lock file yesterday which automatically came but now its like totally different
Dec 8, 2022, 6:59 PM
yes. npm uses package-lock.json and yarn uses yarn.lock
Dec 8, 2022, 7:00 PM
heres the npm or manual question
Dec 8, 2022, 7:01 PM
you could go manual and later run
yarn install
Dec 8, 2022, 7:02 PM
Awww ok I'll do that
Dec 8, 2022, 7:02 PM
The blog one didn't give me a schema.js file either
Dec 8, 2022, 7:07 PM
user E
what does your file structure look like after you finish initializing a project?
Dec 8, 2022, 7:15 PM
Hi there, Ima take a screenshot really quick and send it
Dec 8, 2022, 7:18 PM
Ok this is the one from yesterday when everything was working fine:
Dec 8, 2022, 7:23 PM
Now it looks like this when i install sanity.io
Dec 8, 2022, 7:23 PM
There's no more schema.js file and on the sanity website I was following along with the guide and it says to put your schemas in the schema.js file but unfortunately when I install sanity now the file structure is totally different.
Dec 8, 2022, 7:25 PM
Ah, ok I see the confusion. The first one you shared is a V2 Studio, but the new V3 version is structured completely differently. You'll add your schemas to your index.js in the schemas directory instead.
Dec 8, 2022, 7:29 PM
I caught this too; it mentions a schema.js file here as well but I can't find the schema.js file. The schema.js file is mentioned in a comment at the top in the screenshot.
Dec 8, 2022, 7:29 PM
There's more info on how a project is structured now here .
Dec 8, 2022, 7:30 PM
Awww ok I see, thanks for the help. I did notice an index.js when I installed sanity earlier today using an empty project
Dec 8, 2022, 7:31 PM
You're welcome! This quite literally changed today, so it's understandable that it was confusing!
Dec 8, 2022, 7:52 PM
Hi, I have the same problem. When I run the project I can't see schema.js in my schema. Any body can help.
Dec 9, 2022, 3:26 PM
In my schema only can see index.js.
Dec 9, 2022, 3:27 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?