Dibwe243
Dibwe243

Reputation: 61

Amplify React build fail with "Module not found: Error: Can't resolve './components/...' in '/codebuild/output/src313005886/src/client-portal/src' "

for some time, I have been wrapping my head around an error preventing me from deploying my react app to AWS Amplify. The compiler seems not to be able to resolve a component during the build phase. I keep getting the following error Module not found: Error: Can't resolve './components/...' in '/codebuild/output/src313005886/src/client-portal/src; please see the attached error output bellow.

enter image description here

Here is the file structure:

enter image description here

Here is how the file is imported:

import AdminCreateEvaluation from "./components/evaluationgeneratorform";

I have tried several solutions, including renaming my files, but the build won't just compile; Any help will be appreciated.

Thank you.

Upvotes: 6

Views: 2034

Answers (1)

Leon
Leon

Reputation: 41

Check if you have changed the "Components" from uppercase to lowercase "components". In my case, I changed it after it had been created on GitHub. But GitHub doesn't update this change. When it's cloned to Amplify host, it's still "Components", so the build failed.

I had to change the name to something else and then change it back to fix the issue.

Upvotes: 4

Related Questions