Currently, I am working on an Expo project integrated with AWS Amplify. To deploy on mobile, I utilize EAS from Expo. However, I frequently encounter this error message:
❌ Metro encountered an error:
Unable to resolve module ./src/aws-exports from /Users/expo/workingdir/build/App.tsx:
None of these files exist:
* src/aws-exports(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
* src/aws-exports/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
11 | import Amplify from 'aws-amplify';
> 12 | import awsconfig from './src/aws-exports';
15 | Amplify.configure(awsconfig);
Even though I have the aws-exports
file and can run it locally without any issues, sometimes building the project results in this error. I haven't been able to identify a pattern as to when it occurs or not.
I suspect that it might be related to my .gitignore
file (I believe EAS may check it before uploading to the server). I have already tried running the command with --clear-cache
, but it hasn't had any noticeable effect.
Do you have any suggestions for what steps I can take next? :)