Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Error building Sanity due to missing module, fixed by copying file and upgrading to v2.6.1

15 replies
Last updated: Mar 5, 2021
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
Same on an old studio I was trying to revisit earlier, actually!
Mar 5, 2021, 4:53 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
My last upgrade was only 2 days ago, unfortunately.
Mar 5, 2021, 5:06 PM
user K
user P
If you wouldn’t mind trying something, could you copy 
node_modules/@sanity/form-builder/lib/patch/patches.js
 into 
node_modules/@sanity/form-builder/lib/utils
? The file should exist in both places (just until this is resolved in a future release). It looks like for some reason, there’s a problem resolving the import.
Mar 5, 2021, 6:07 PM
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
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
I’m only having trouble on old versions that I upgraded to 2.6.0.
Mar 5, 2021, 6:40 PM
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
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
I'll see if I can publish a version that aliases to the right place, for now
Mar 5, 2021, 8:06 PM
Published v2.6.1 - should hopefully be fixed if you upgrade now!
Mar 5, 2021, 8:36 PM
awesome thanks Espen -- I'll try it out!
Mar 5, 2021, 8:38 PM
This worked for me. Appreciate the quick help
user Z
and
user A
! 👏
Mar 5, 2021, 8:55 PM
Glad to hear it, Malcolm!
Mar 5, 2021, 9:25 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?