I am trying to build my react-native app with Expo, the project is working correctly on the local host, however when trying to build my Expo application, I came across the following error message:
Error: Unable to resolve module ./src/aws-exports from /home/expo/workingdir/build/App.js:
None of these files exist:
* src/aws-exports(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
* src/aws-exports/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.cjs|.native.cjs|.cjs)
21 | import { Amplify } from '@aws-amplify/core';
22 | import { Storage } from '@aws-amplify/storage';
> 23 | import awsconfig from './src/aws-exports';
| ^
.
.
.
Here are the actions I took to try to resolve the problem:
-
I deleted and reinstalled
node_modules
andpackage-lock.json
, in the
hope that the error was due to some corruption in the modules. -
I used the
expo start -c
command to clear Expo’s cache. -
I reviewed my module configuration and made sure that the aws-exports file was in the right place and with the right name.
2
Answers
I had the same problem and the solution that worked for me was to create a new folder to put the settings from the
aws-exports.js
file.For example, I created an
AWSexports
file inside thecomponents
folder.And I imported
import awsconfig from './components/AWSexports'
.Remove
aws-exports.js
from your.gitignore
.