ndimatteo / HULL

💀 Headless Shopify Starter – powered by Next.js + Sanity.io
https://hull.dev
MIT License
1.36k stars 167 forks source link

Deploy Error While Building Sanity started to happen 3 days ago #110

Closed kuleyu closed 1 year ago

kuleyu commented 1 year ago

Here are the deployment logs:

18:26:42.680 | [4/4] Building fresh packages...
18:26:45.597 | success Saved lockfile.
18:26:45.602 | Done in 82.03s.
18:26:45.676 | Done in 1m 23.6s
18:26:45.689 | Detected Next.js version: 12.3.0
18:26:45.698 | Running "pnpm run build"
18:26:46.318 |  
18:26:46.318 | > hull@2.6.0 build /vercel/path0
18:26:46.318 | > echo 'Building Sanity to public/studio…' && cd studio && npx sanity build ../public/studio -y && cd .. && next build
18:26:46.319 |  
18:26:46.325 | Building Sanity to public/studio…
18:26:48.903 | - Clearing output folder
18:26:48.907 | ✔ Clearing output folder (8ms)
18:26:48.908 | - Building Sanity
18:27:19.810 | ✖ Building Sanity
18:27:19.811 |  
18:27:19.811 | Error: Errors while building:
18:27:19.811 | ./node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js
18:27:19.811 | Module parse failed: Unexpected token (307:11)
18:27:19.811 | You may need an appropriate loader to handle this file type.
18:27:19.812 | \|   }
18:27:19.812 | \|
18:27:19.812 | \|   return { ...rect,
18:27:19.812 | \|     x: rect.x - scroll.scrollLeft + offsets.x,
18:27:19.812 | \|     y: rect.y - scroll.scrollTop + offsets.y
18:27:19.812 | @ ./node_modules/react-select/dist/react-select.esm.js 24:0-26
18:27:19.812 | @ ./node_modules/sanity-plugin-media/dist/components/SearchFacetTags/index.js
18:27:19.813 | @ ./node_modules/sanity-plugin-media/dist/components/Controls/index.js
18:27:19.813 | @ ./node_modules/sanity-plugin-media/dist/components/Browser/index.js
18:27:19.813 | @ ./node_modules/sanity-plugin-media/dist/app.js
18:27:19.813 | @ ./node_modules/sanity-plugin-media/dist/index.js
18:27:19.813 | @ ./node_modules/sanity-plugin-media/dist?sanityPart=all%3Apart%3A%40sanity%2Fbase%2Ftool
18:27:19.813 | @ ./node_modules/@sanity/default-layout/lib/util/getRegisteredTools.js
18:27:19.813 | @ ./node_modules/@sanity/default-layout/lib/router.js
18:27:19.813 | @ ./node_modules/@sanity/default-layout/lib/Root.js?sanityPart=part%3A%40sanity%2Fbase%2Froot
18:27:19.813 | @ ./node_modules/@sanity/base/lib/components/SanityRoot.js?sanityPart=part%3A%40sanity%2Fbase%2Fsanity-root
18:27:19.814 | @ ./node_modules/@sanity/server/lib/browser/entry.js
18:27:19.814 | @ multi ./node_modules/@sanity/server/lib/browser/entry.js
18:27:19.814 | at buildStaticAssets (~/path0/studio/node_modules/@sanity/core/lib/actions/build/buildStaticAssets.js:103:13)
18:27:19.869 | ELIFECYCLE  Command failed with exit code 1.
18:27:19.891 | Error: Command "pnpm run build" exited with 1

It seems that the error may be caused by some dependencies' update, as there is no error 3 days ago, and no error in my local building progress.

How can we solve this problem? Thank you in advance!

kasperbirch1 commented 1 year ago

I'm experiencing the same issue 👀

jwoa commented 1 year ago

Same here, can't get it working from the Vercel one click either

ndimatteo commented 1 year ago

This sounds like an issue with either the sanity studio packages, or the sanity-plugin-media plugin. Can you try upgrading the versions and see if you're able to build and deploy?

jwoa commented 1 year ago

Thanks! I’ll try a manual install and upgrade the packages like you said. My issue was with the automatic deploys on vercel only, the sanity one click worked just fine.

kasperbirch1 commented 1 year ago

I've had success going to the studio folder and running yarn add sanity-plugin-media@1.4.13

anendlesssupply commented 1 year ago

I believe I hit the same issue (deploying to Netlify though). I solved it by adding a webpack.sanity.js file in the studio folder, with the following config:

module.exports = function (config, options) {
    config.module.rules[0].exclude =
      /(node_modules|bower_components)\/(?!@floating-ui)/;
    return config;
  };
kuleyu commented 1 year ago

I've had success going to the studio folder and running yarn add sanity-plugin-media@1.4.13

Thanks @kasperbirch1, @ndimatteo and @anendlesssupply, it works. So the bug seems to be brought by its new version sanity-plugin-media@1.4.14 (2022-11-22).

ndimatteo commented 1 year ago

Closing for the same reason as this: https://github.com/ndimatteo/HULL/issues/114#issuecomment-1366973543