Error building Sanity due to missing module, fixed by copying file and upgrading to v2.6.1
15 replies
Last updated: Mar 5, 2021
M
Just did an sanity upgrade and getting these errors ... anyone seen this or have any ideas? I've done several upgrades before no problem. I am using OOTB studio.
✔ Checking project info ✔ Clearing output folder (7ms) ✖ Building Sanity Error: Errors while building: ./node_modules/@sanity/form-builder/lib/sanity/uploads/uploaders.js Module not found: Error: Can't resolve '../../utils/patches' in '/home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/lib/sanity/uploads' resolve '../../utils/patches' in '/home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/lib/sanity/uploads' using description file: /home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/package.json (relative path: ./lib/sanity/uploads) Field 'browser' doesn't contain a valid alias configuration after using description file: /home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/package.json (relative path: ./lib/sanity/uploads) using description file: /home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/package.json (relative path: ./lib/utils/patches) no extension Field 'browser' doesn't contain a valid alias configuration /home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/lib/utils/patches doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /home/x/dev/projects/c4c/climbing4change-cms/node_modules/@sanity/form-builder/lib/utils/patches.js doesn't exist .jsx ...
Mar 5, 2021, 4:50 PM
Wasn’t urgent so I’ve left it for now but would love to know if there is a solution for this. I was deleting node_modules etc. but haven’t made the situation better…
Mar 5, 2021, 4:54 PM
M
My last upgrade was only 2 days ago, unfortunately.
Mar 5, 2021, 5:06 PM
G
user K
user P
If you wouldn’t mind trying something, could you copy node_modules/@sanity/form-builder/lib/patch/patches.js
node_modules/@sanity/form-builder/lib/utils
Mar 5, 2021, 6:07 PM
M
hmmm - i got through compilation successfully by copying the file as you recommended, but for some reason I can't get to the site when doing sanity start (connection refused at localhost:3333). But perhaps that's something else going on.
Mar 5, 2021, 6:39 PM
G
What’s even weirder is that I just tried running a project that I bootstrapped yesterday—same versions of everything—and it started up without issue.
Mar 5, 2021, 6:40 PM
G
I’m only having trouble on old versions that I upgraded to 2.6.0.
Mar 5, 2021, 6:40 PM
M
looking at my git history, I went from 2.5.0 to 2.6.0 and encountered the issue.
Mar 5, 2021, 6:44 PM
G
I’ve logged it here: https://github.com/sanity-io/sanity/issues/2363
Mar 5, 2021, 6:49 PM
Wow, this bug is weird. It looks like yarn has upgraded the form-builder package, but somehow doesn't have the right contents. The tarball on npm has the right version, but it seems after upgrade not to have overwritten the actual content in node_modules..
Mar 5, 2021, 8:01 PM
M
awesome thanks Espen -- I'll try it out!
Mar 5, 2021, 8:38 PM
M
This worked for me. Appreciate the quick help
user Z
and user A
! 👏Mar 5, 2021, 8:55 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.