🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Error in running "sanity start" command, package 'next' not found in schema.js file.

6 replies
Last updated: Nov 25, 2022
Hi everyone!
A few days everything was working finde when I used the command


sanity start
but when I tried to run it today, I am getting an error:


✔ Checking configuration files...
⠦ Compiling...webpack built 13b315e7094243c5af96 in 10658ms
✔ Compiling...
Failed to compile.

Error in ./schemas/schema.js (part:@sanity/base/schema)
Module build failed: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'next' imported from /home/user/Documents/dci/my-projects/myPortfolio/portfolio-sanity/babel-virtual-resolve-base.js
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
 @ ./node_modules/@sanity/default-layout/lib/schemaErrors/SchemaErrorReporter.js 8:37-72
 @ ./node_modules/@sanity/default-layout/lib/defaultLayout/DefaultLayout.js
 @ ./node_modules/@sanity/default-layout/lib/defaultLayout/index.js
 @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
 @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
 @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
 @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js
I am still quite new in it, so could anyone explain me please how to resolve it.
Thanks in advance!!!
Nov 25, 2022, 4:13 PM
It looks like you’re trying to import a package in your
schema.js
file that doesn’t exist
Nov 25, 2022, 4:40 PM
Are you able to share the code from the
./schemas/schema.js
file?
Nov 25, 2022, 4:40 PM
import createSchema from 'part:@sanity/base/schema-creator'
import schemaTypes from 'all:part:@sanity/base/schema-type'
import home from './home'
import about from './about'
import project from './project'

export default createSchema({
  name: 'default',
  types: schemaTypes.concat([
    home,
    about,
    project,
  ]),
})
I have not changed anything in this file since last time.
Nov 25, 2022, 4:54 PM
user J
I have even reinstalled all the packages but still not working.I am getting confused as well
Nov 25, 2022, 4:55 PM
user J
Thanks a lot it worked!
Nov 25, 2022, 5:44 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?