πŸ‘‹ Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Issue with v3 migration and error resolving dependencies in Sanity Studio.

3 replies
Last updated: Jan 26, 2023
Hello, I have a #v3 migration question.
I followed the
migration guide but I have run into an error that I am blocked on. (I have deleted and re-installed node_modules and package-lock.json and run installs of plugins to get latest versions).
The error looks like this:


βœ” Checking configuration files...
Sanity Studio using vite@4.0.4 ready in 3258ms and running at <http://localhost:3333/>
✘ [ERROR] Could not resolve "part:@sanity/base/image-icon"

    node_modules/sanity-plugin-media/dist/index.js:6:43:
      6 β”‚ ...image_icon_1 = __importDefault(require("part:@sanity/base/image-icon"));
        β•΅                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/base/image-icon" as external to exclude it from
  the bundle, which will remove this error. You can also surround this "require" call
  with a try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "part:@sanity/base/client"

    node_modules/sanity-plugin-media/dist/client.js:7:39:
      7 β”‚ var client_1 = __importDefault(require("part:@sanity/base/client"));
        β•΅                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/base/client" as external to exclude it from the
  bundle, which will remove this error. You can also surround this "require" call
  with a try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "part:@sanity/base/router"

    node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:11:23:
      11 β”‚ var router_1 = require("part:@sanity/base/router");
         β•΅                        ~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/base/router" as external to exclude it from the
  bundle, which will remove this error. You can also surround this "require" call
  with a try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "part:@sanity/base/preview"

    node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:12:40:
      12 β”‚ var preview_1 = __importDefault(require("part:@sanity/base/preview"));
         β•΅                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/base/preview" as external to exclude it from
  the bundle, which will remove this error. You can also surround this "require" call
  with a try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "part:@sanity/base/schema"

    node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:13:39:
      13 β”‚ var schema_1 = __importDefault(require("part:@sanity/base/schema"));
         β•΅                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/base/schema" as external to exclude it from the
  bundle, which will remove this error. You can also surround this "require" call
  with a try/catch block to handle this failure at run-time instead of bundle-time.

✘ [ERROR] Could not resolve "part:@sanity/base/with-referring-documents"

    node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:14:41:
      14 β”‚ ...ng_documents_1 = require("part:@sanity/base/with-referring-documents");
         β•΅                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "part:@sanity/base/with-referring-documents" as external to
  exclude it from the bundle, which will remove this error. You can also surround
  this "require" call with a try/catch block to handle this failure at run-time
  instead of bundle-time.

5:58:30 PM [vite] error while updating dependencies:
Error: Build failed with 6 errors:
node_modules/sanity-plugin-media/dist/client.js:7:39: ERROR: Could not resolve "part:@sanity/base/client"
node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:11:23: ERROR: Could not resolve "part:@sanity/base/router"
node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:12:40: ERROR: Could not resolve "part:@sanity/base/preview"
node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:13:39: ERROR: Could not resolve "part:@sanity/base/schema"
node_modules/sanity-plugin-media/dist/components/DocumentList/index.js:14:41: ERROR: Could not resolve "part:@sanity/base/with-referring-documents"
...
    at failureErrorWithLog (/Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:1604:15)
    at /Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:1056:28
    at runOnEndCallbacks (/Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:1476:61)
    at buildResponseToResult (/Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:1054:7)
    at /Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:1166:14
    at responseCallbacks.<computed> (/Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:701:9)
    at handleIncomingPacket (/Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:756:9)
    at Socket.readFromStdout (/Users/henrybabbage/Repos/bortolozzi/studio/node_modules/esbuild/lib/main.js:677:7)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
^C
Familiar at all? Any suggestions?

Many thanks in advance.
Jan 26, 2023, 5:02 AM
Hi Henry. It looks like v1.5.1 or earlier of the
media
plugin is getting installed. What does your package.json look like?
Jan 26, 2023, 5:59 AM
Hi Geoff, you were right. I just needed to uninstall the media plugin and that got the studio running, and then I reinstalled the media plugin with --force and I got the updated version and now everything is working fine. I should have been a bit more patient! Thank you!
Jan 26, 2023, 6:22 AM
Glad to hear you’re up and running! πŸ™Œ
Jan 26, 2023, 6:25 AM

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?