Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve vercel "ModuleNotFoundError" when deploying Next js app

I've been getting this ModuleNotFoundError whenever I try to deploy my website to vercel. I have renamed my components and CSS modules but for some reason, I keep getting this error.

Does anyone know how to solve this issue, because I have no idea what I'm getting wrong?

Screenshot of error log

enter image description here

like image 929
jowell Avatar asked Oct 20 '25 14:10

jowell


1 Answers

If you has been changed the name of folder or file to lowercase or uppercase, for example: from /Components to /components

The problem shold be because you remote branch didn't update, and in local brach the name already is correct, your solution run, but the vercel use linux, that is casesensitive, so, the ModuleNotFoundError occurred.

To solve the problem, you can save your folder/file at other place, and then deleted it from project and commit it. After commit you should copy and past the file/folder saved in another place in your project again and commit to push to romete branch with correctly structure. You also can use the command "git mv "oldfileOrFolder" "newFileOrFolder", see the documentation.

like image 115
Ailton Bueno Avatar answered Oct 23 '25 05:10

Ailton Bueno