Parsing error: Cannot find module '@babel/preset-env' in schemas folder

12 replies
Last updated: Jan 28, 2026
Wondering if anyone else has run into this — I have an error popping up only in my
schemas
folder for some reason:
Parsing error: Cannot find module '@babel/preset-env'
Not entirely sure what’s causing it, I’ve tried googling the error and making suggested changes to my various config files but so far nothing I’ve tried helps. I’m not super familiar with what’s going on behind the scenes with some of these node packages that come with Sanity so any guidance would be appreciated.

For what it’s worth, I moved this
studio
directory from a different directory, and everything seems to be working fine at least in development (data and sanity studio are working fine on localhost:3333 and in local front end), but I can’t figure out what’s causing this parsing error.
AI Update

This is typically a VSCode/ESLint configuration issue rather than a Sanity-specific problem. Since your studio is working fine in development and the error only appears in your editor, it's a tooling issue with how ESLint is trying to parse your files.

First, identify what's actually causing the error:

The error message suggests ESLint is trying to use Babel to parse your schema files but can't find the necessary dependencies. Before installing anything, check what ESLint configuration you're actually using:

  1. Look in your package.json for any eslint-config-* packages
  2. Check your .eslintrc (or .eslintrc.json, .eslintrc.js) file to see what you're extending

Common solutions to try:

1. VSCode ESLint working directory issue (especially relevant since you moved directories)

If you're in a monorepo or moved your studio folder, VSCode's ESLint extension might be looking for dependencies in the wrong place. Add this to your .vscode/settings.json in your studio directory:

{
  "eslint.workingDirectories": [
    { "mode": "auto" }
  ]
}

Or specify the studio directory explicitly if it's nested:

{
  "eslint.workingDirectories": [
    "./studio"
  ]
}

2. Clear caches and reinstall

Since you moved the directory, stale references might be causing issues:

rm -rf node_modules package-lock.json
npm install

Then restart VSCode completely.

3. Install the missing dependencies only if you confirm they're needed

Only do this if your ESLint config explicitly requires Babel parsing. Check your .eslintrc for parser: '@babel/eslint-parser' or similar. If it's there:

npm install --save-dev @babel/preset-env @babel/preset-react

4. Disable ESLint for schemas if it's not adding value

If you don't need linting on your schema files (they're mostly configuration), you can tell ESLint to skip them. Add to your .eslintrc.json:

{
  "ignorePatterns": ["schemas/"]
}

5. Reload the ESLint server in VSCode

Open the command palette (Cmd/Ctrl + Shift + P) and run "ESLint: Restart ESLint Server"

The key here is that this is an editor/linting configuration issue, not a Sanity problem. Since everything works in development, you're not blocked from building or deploying. The most likely culprit is VSCode's ESLint extension looking for dependencies in the wrong location after you moved the directory, which the workingDirectories setting should resolve.

Show original thread
12 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?