ricokahler / sanity-codegen

Generate TypeScript types from your Sanity.io schemas
sanity-codegen-dev.vercel.app
MIT License
270 stars 19 forks source link

Missing dependencies? #257

Open toresbe opened 2 years ago

toresbe commented 2 years ago

Hiya,

I am learning sanity with a basic Typescript create-next-app. I followed the installation instructions and ran yarn add --dev sanity-codegen prettier, but it failed with Error: Cannot find module '@babel/core'.

After cycling through attempts to run and adding missing dependencies, I found that yarn add --dev @babel/core @babel/preset-env @babel/preset-typescript @babel/preset-react jsdom gets me a working setup so far.

danmichaelo commented 2 years ago

I ran into Error: Cannot find module '@babel/core' now, but it turned out to be because I was using sanity-codegen in a bare project that missed the standard Sanity packages (@sanity/base, @sanity/core etc.). In a normal Sanity project, the babel packages should already be available.