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.
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:
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.