How do I resolve a 'module not found' error?

Information on resolving a 'module not found' error.
Last updated on March 16, 2023
Build, Deployment & Git

The 'module not found' error is a syntax error that appears when the static import statement cannot find the file at the declared path. This common syntax error is caused by letter-casing inconsistencies that are present in your filename(s) between your repository and local machine, or both.

One possible cause for this issue is the fact that some filesystems are case-insensitive, however Vercel deployments use a case-sensitive filesystem. Because of this, it is possible that when you change the letter-casing in filenames on your local machine, Git will only pick up changes in your respective static import statements. This would mean that your repository is now syntactically incorrect, resulting in a build error when deploying the repository on the Vercel platform.

The build logs will indirectly point to the file that is the causing the issue. Make sure that your file's letter-casing correctly matches with its respective static imports. Also make sure that your letter-casing in your filenames and imports are identical between your repository and local machine. If you are using git, make sure git config core.ignorecase false is set in your environment.

Couldn't find the guide you need?