skip to Main Content

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 and package-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


  1. 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 the components folder.

    And I imported import awsconfig from './components/AWSexports'.

    Login or Signup to reply.
  2. Remove aws-exports.js from your .gitignore.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search