6

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.

2
  • 2
    I've been receiving the same error as of recently. After adding Amplify backend to the React app, it no longer deploys and fails with a similar error. "Failed to compile. Module not found: Error: Can't resolve './components/ResponsiveDrawer'" - Did you find anything since posting?
    – alanphil
    Apr 4, 2022 at 11:54
  • Similar issue here my build fails with: Failed to compile. 2022-05-04T13:58:33.330Z [INFO]: Module not found: Error: Can't resolve 'aws-amplify' in '/codebuild/output/src{some number...}/src/{some project...}/src' May 4, 2022 at 14:22

1 Answer 1

3

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.

1
  • This solved my issue with app.tsx. Thanmks :) Nov 7, 2022 at 9:31

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.