How to fix "VipsJpeg: Premature end of JPEG file" for Gatsby + Contentful + Netlify
My Gatsby website was running and building correctly in my local but when Netlify started the deployment, the build failed because the following error
VipsJpeg: Premature end of JPEG file
This is the full log of the error
I did some research to troubleshoot an issue, but I couldn't find a specific fix. Although my code wasn't generating any errors, I noticed a significant difference between Netlify and my local environment: Netlify was using NodeJS version v10.19.0, while my local environment was using v8.16.2. To resolve the issue, I created an .nvmrc file in the root of my project, specifying the NodeJS version I was using (v8.16.2) and pushed it to Netlify. This fixed the problem.