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

Issue with updating Studio and running it after the update.

22 replies
Last updated: Jul 8, 2022
For some reason when I update the Studio it fails when I try to run it. With the following errors:
[2] Failed to compile.
[2] 
[2] Error in ./node_modules/@math.gl/web-mercator/dist/esm/fly-to-viewport.js
[2] Module parse failed: Unexpected token (50:17)
[2] You may need an appropriate loader to handle this file type.
[2] | }
[2] | export function getFlyToDuration(startProps, endProps, options) {
[2] |   const opts = { ...DEFAULT_OPTS,
[2] |     ...options
[2] |   };
[2]  @ ./node_modules/@math.gl/web-mercator/dist/esm/index.js 6:0-79
[2]  @ ./node_modules/react-map-gl/node_modules/viewport-mercator-project/module.js
[2]  @ ./node_modules/react-map-gl/dist/esm/index.js
[2]  @ ./node_modules/sanity-plugin-mapbox-input/lib/GeopointInput.js (part:@sanity/form-builder/input/geopoint)
[2]  @ ./node_modules/@sanity/form-builder/lib/legacyParts.js
[2]  @ ./node_modules/@sanity/form-builder/lib/sanity/formBuilderValueStore.js
[2]  @ ./node_modules/@sanity/form-builder/lib/sanity/legacyPartImplementations/form-builder.js (part:@sanity/form-builder)
[2]  @ ./node_modules/sanity-plugin-better-slug/lib/SlugInput.js
[2]  @ ./schemas/rwr/documents/course.js
[2]  @ ./schemas/schema.js (part:@sanity/base/schema)
[2]  @ ./node_modules/@sanity/vision/lib/SanityVision.js
[2]  @ ./node_modules/@sanity/vision/lib/VisionTool.js
[2]  @ ./node_modules/@sanity/vision/lib/VisionTool.js (all:part:@sanity/base/tool)
[2]  @ ./node_modules/@sanity/default-layout/lib/util/getRegisteredTools.js
[2]  @ ./node_modules/@sanity/default-layout/lib/router.js
[2]  @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
[2]  @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
[2]  @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
[2]  @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js
[2] 
[2] Error in ./node_modules/mjolnir.js/dist/esm/event-manager.js
[2] Module parse failed: Unexpected token (50:25)
[2] You may need an appropriate loader to handle this file type.
[2] |             this.manager.emit(event.type, event);
[2] |         };
[2] |         this.options = { ...DEFAULT_OPTIONS, ...options };
[2] |         this.events = new Map();
[2] |         this.setElement(element);
[2]  @ ./node_modules/mjolnir.js/dist/esm/index.js 1:0-58
[2]  @ ./node_modules/react-map-gl/dist/esm/components/interactive-map.js
[2]  @ ./node_modules/react-map-gl/dist/esm/index.js
[2]  @ ./node_modules/sanity-plugin-mapbox-input/lib/GeopointInput.js (part:@sanity/form-builder/input/geopoint)
[2]  @ ./node_modules/@sanity/form-builder/lib/legacyParts.js
[2]  @ ./node_modules/@sanity/form-builder/lib/sanity/formBuilderValueStore.js
[2]  @ ./node_modules/@sanity/form-builder/lib/sanity/legacyPartImplementations/form-builder.js (part:@sanity/form-builder)
[2]  @ ./node_modules/sanity-plugin-better-slug/lib/SlugInput.js
[2]  @ ./schemas/rwr/documents/course.js
[2]  @ ./schemas/schema.js (part:@sanity/base/schema)
[2]  @ ./node_modules/@sanity/vision/lib/SanityVision.js
[2]  @ ./node_modules/@sanity/vision/lib/VisionTool.js
[2]  @ ./node_modules/@sanity/vision/lib/VisionTool.js (all:part:@sanity/base/tool)
[2]  @ ./node_modules/@sanity/default-layout/lib/util/getRegisteredTools.js
[2]  @ ./node_modules/@sanity/default-layout/lib/router.js
[2]  @ ./node_modules/@sanity/default-layout/lib/Root.js (part:@sanity/base/root)
[2]  @ ./node_modules/@sanity/base/lib/components/SanityRoot.js (part:@sanity/base/sanity-root)
[2]  @ ./node_modules/@sanity/server/lib/browser/entry-dev.js
[2]  @ multi ./node_modules/@sanity/server/lib/browser/entry-dev.js
I upgraded from ver 2.25.0 to 2.30.1 (diff attached in the screenshot) and I am running node version 14.15.5 if that helps…
Jun 27, 2022, 9:12 PM
Hmm, maybe try
rm -rf node_modules
then
npm i
to see if that helps?
Jun 27, 2022, 9:14 PM
That
getFlyToDuration
function doesn’t look to be part of the default Sanity Studio. Can you trace it to any particular plugins or components you’re using?
Jun 27, 2022, 9:19 PM
Are you using the
mapbox-input
plugin? It looks like it could be the source.
Jun 27, 2022, 9:23 PM
user A
Yes I am using it for
sanity-plugin-mapbox-input
Jun 27, 2022, 9:25 PM
user M
thank you, but unfortunately it didn’t help
Jun 27, 2022, 9:26 PM
user A
I am using it with the
geopoint
type
Jun 27, 2022, 9:28 PM
Here’s my list of dependancies if that helps:
 "@sanity/base": "^2.30.1",
    "@sanity/cli": "^2.25.0",
    "@sanity/code-input": "^2.30.1",
    "@sanity/components": "^2.14.0",
    "@sanity/core": "^2.30.1",
    "@sanity/default-layout": "^2.30.1",
    "@sanity/default-login": "^2.30.1",
    "@sanity/desk-tool": "^2.30.1",
    "@sanity/rich-date-input": "^2.0.9",
    "@sanity/vision": "^2.30.1",
    "g": "^2.0.1",
    "get-video-id": "^3.4.1",
    "lodash": "^4.17.21",
    "prop-types": "^15.6",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-hook-form": "^7.3.6",
    "react-icons": "^4.3.1",
    "react-time-picker": "^4.4.4",
    "react-timepicker": "^2.0.2",
    "sanity-plugin-asset-source-ogimage": "^1.0.6",
    "sanity-plugin-asset-source-unsplash": "^0.1.5",
    "sanity-plugin-autocomplete-tags": "^1.0.2",
    "sanity-plugin-better-slug": "^1.0.0",
    "sanity-plugin-color-list": "^2.0.2",
    "sanity-plugin-duplicate-array-item": "^1.1.0",
    "sanity-plugin-icon-picker": "^2.0.1",
    "sanity-plugin-mapbox-input": "^0.0.3",
    "sanity-plugin-media": "^1.4.2",
    "sanity-plugin-table": "^2.3.0",
    "sanity-plugin-vercel-deploy": "^2.1.6",
    "styled-components": "^5.3.3",
    "validator": "^13.7.0"
Jun 27, 2022, 9:30 PM
Thanks for that. Would you be able to post a minimal reproduction of your schema that throws the error?
Jun 27, 2022, 9:38 PM
user A
sure, so it says it’s
schemas/rwr/documents/course.js
doesn’t have anything to do with the map, but I’ll add that one and
liveInPersonCourse.js
which is an object type that’s pulled in via an Array that includes the object
location.js
which includes the
geopoint
type
Jun 27, 2022, 9:46 PM
I am heading out for a bit, but I’ll be on later. (so if I don’t reply that’s why). I really appreciate the help!
Jun 27, 2022, 9:47 PM
Unfortunately, I’m not able to replicate the error (everything works). Is there a component that’s rendering the geopoint data on a map?
Jun 27, 2022, 10:19 PM
Really. That's interesting. Did you use my exact same dependencies?
Jun 27, 2022, 10:21 PM
Yes. Started where you did and upgraded to the versions in the diff.
Jun 27, 2022, 10:35 PM
Ok. Thanks for letting me know and testing it. I'll check it out again and see.
Jun 27, 2022, 10:45 PM
Never mind. I missed a step, and now can replicate. It’s the end of my day but I’ll pick this back up tomorrow.
Jun 27, 2022, 11:03 PM
Ok. No problem. Thanks again for your help! I'll work on it later tonight and post if I find anything.
Jun 27, 2022, 11:06 PM
Have a great rest of your day
user A
Jun 27, 2022, 11:06 PM
You too!
Jun 27, 2022, 11:29 PM
Okay, looks like recent updates to two packages are using spread syntax and the v2 Studio can’t handle them. There may be a better way, but this option seems to work for me:
1. Delete node_modules and your yarn.lock file.
2. Add the following to package.json then reinstall:

"resolutions": {
  "@math.gl/web-mercator": "3.5.7",
  "mjolnir.js": "2.6.0"
}
Jun 28, 2022, 4:22 PM
I didn’t test it in the Studio as I don’t have a token configured, but the Studio compiles.
Jun 28, 2022, 4:24 PM
Agg, sorry
user A
I forgot to reply. I updated my package file with with those “resolutions” and it worked great. Thanks for your help! You’re amazing. Have a great weekend!
Jul 8, 2022, 5:57 PM
Wow, that’s great to hear! 🎉 Thanks for following up, Brent, and a great weekend to you too.
Jul 8, 2022, 6:28 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?