Astro site not building | error Command failed with exit code 1

Hey everyone,

My Netlify (Astro) site (exquisite-quokka-ce439e.netlify.app) stopped deploying recently, it says

error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

and references:

File:
6:23:11 PM: /opt/build/repo/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:77:77

The project builds fine locally, but won’t build on Netlify.

I have a couple React components that have always worked but have recently introduced an npm package for an image carousel, but it still builds locally and I don’t know how to resolve this.

Hi @TylerThomas, thanks for the post and welcome to the Netlify Support forums.
Kindly visit the Stackoverflow link below and follow the suggestions there as the problem seems to be similar to yours.

Alternatively you can also visit the React issues page below which also has suggestion on how to fix the problem similar to yours.

Let me know the outcome.

Thanks.

1 Like

I knew which component was causing the issues from the logs, but it’s just the way Netlify is handling it because it builds on local, if the issue was the above it would not work on local, I’ve disabled the component and will look for a different npm package that Netlify wont have an issue with. The component in question is nuka-carousel 5.5.1, thanks for the help though!

EDIT: Realised the problem was me, it wasn’t building locally as well, so I’ll have to figure it out, thanks for the help once again.

Netlify is not a mystery-box doing anything special or different during site builds. It’s running the code you’re providing it. There are however platform differences in various cases, primarily Netlify uses Ubuntu while most users don’t. Some libraries might behave differently on different Operating Systems.

For example, here’s an old thread showing a different issue with Astro only on Ubuntu:

2 Likes

Okay I realised my mistake I will close the issue, it’s an issue with Astro, I assumed because astro dev worked perfectly, astro build should just work as well. It’s also the only React package that I have in the project so I may not be handling it correctly, my bad.

1 Like