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

Issue with upgrading Sanity versions causing errors, resolved by deleting node_modules folder.

3 replies
Last updated: Aug 25, 2021
Has anyone run into this? It seems every time I upgrade Sanity versions I can't start/build/deploy anymore until I delete the entire node_modules folder. I get errors around "options.customize should be string":
Failed to compile.

Error in ./schemas/schema.ts (part:@sanity/base/schema)
Module build failed: ValidationError: [object Object] Invalid Options

options.customize should be string
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
 @ ./node_modules/@sanity/default-layout/lib/util/getNewDocumentModalActions.js 8:37-72
 @ ./node_modules/@sanity/default-layout/lib/DefaultLayout.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

Error in ./parts/resolveProductionUrl.ts (part:@sanity/production-preview/resolve-production-url)
Module build failed: ValidationError: [object Object] Invalid Options

options.customize should be string
    at Generator.next (<anonymous>)
    at new Promise (<anonymous>)
 @ ./node_modules/@sanity/production-preview/lib/resolveProductionUrl.js (part:@sanity/transitional/production-preview/resolve-production-url 13:51-116)
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/usePreviewUrl.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/documentPane.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/documentPaneProvider.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/documentPane/index.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/DeskToolPane.js
 @ ./node_modules/@sanity/desk-tool/lib/panes/index.js
 @ ./node_modules/@sanity/desk-tool/lib/tool/DeskToolPanes.js
 @ ./node_modules/@sanity/desk-tool/lib/tool/DeskTool.js
 @ ./node_modules/@sanity/desk-tool/lib/tool/index.js
 @ ./node_modules/sanity-plugin-vercel-deploy/dist (all:part:@sanity/base/tool)
 @ ./node_modules/@sanity/default-layout/lib/router.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

Aug 12, 2021, 11:51 PM
Hey User! This can happen when upgrading for a few reasons, but I believe it’s usually because of mismatching or duplicate dependencies. Cleaning your node modules with
rm -rf node_modules && npm i
resolves it. I’ll see if I can get a clearer answer on why it happens, though!
Aug 13, 2021, 4:32 PM
Hey thanks, good to have some confirmation so I don't feel crazy 😄 But yeah that's been the solution so far. I have found it pretty consistently happens every time I upgrade though, so I thought I'd report it in case it's something that can be mitigated with future changes to that upgrade process within Sanity CLI
Aug 13, 2021, 4:38 PM
I got the exact same thing, thanks for reporting on here
Aug 25, 2021, 8: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?