'React app deployment to Netlify : Module not found: Error: Can't resolve './pages/HomePage' in '/opt/build/repo/src'

Deplyment Error

How can I solve this error?

I tried many approaches like using Netlify CLI, linking to git and github but nothing worked.

The app works fine in development mode with no errors but it shows Error:404 page not found on both Netlify and Github Pages

The link of the deployed app

What should I do?



Solution 1:[1]

I found the solution, I changed the folders' names and pushed them into Github but Github didn't change the folders' names, and Netlify is case-sensitive towards nomenclature.

Solution 2:[2]

Check your directory names using gitbash terminal, as it works like a linux Netlify/Vercel are linux containers check the actual case using gitbash and fix the name as per the import enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 karim_mo
Solution 2 arung86