Next.js Discord

Discord Forum

Deployment to Vercel 'failed to compile'

Unanswered
Giant Angora posted this in #help-forum
Open in Discord
Giant AngoraOP
When running npm run build command on local, everything works fine but vercel cannot build due to 'failed to compile' error. I am trying to deploy through github repo. I also have many 'Module not found' errors, which I think might be the root of the issue

11 Replies

Common Moorhen
hi
have you deleted the lock file?
Giant AngoraOP
No I have not, should I delete that and retry deploying?
Giant AngoraOP
Never mind, I was able to fix the errors by changing the casing of my files and components. I found help here:
https://nextjs.org/docs/messages/module-not-found
and then updated my cached files using the git commands here:
https://stackoverflow.com/questions/62378045/how-to-fix-next-js-vercel-deployment-module-not-found-error?rq=1
I then ran into this error:
RangeError: Maximum call stack size exceeded

which was due to the Nextjs Sharp package, https://nextjs-forum.com/post/1195495084129529875
I uninstalled that and was able to successfully deploy!
it may be because vercel may be deploying the aplication on a machine that doesnt support case sensitives
and your machine does, thats why it was failing on vercel but not on local
mark the message with the answer with a check
Giant AngoraOP
That's what I figured as well. Thank you
Common Moorhen
👍