rdrgtec
rdrgtec

Reputation: 640

Module not found: Error: Can't resolve '../aws-exports' (React-Native Expo Web)

I've developed an app which works perfectly when I run it through expo start --tunnel and then the w key for expo web.

In order to deploy it, I have tried to use the Amplify console, which seemed to work. However, while deploying the app, it has halted with the following messages:

2020-02-10T16:39:57.658Z [WARNING]: <s> [webpack.Progress] 70% building 41/59 modules 18 active /root/.nvm/versions/node/v10.16.0/lib/node_modules/expo-cli/node_modules/babel-loader/lib/index.js??ref--5-oneOf-2!/codebuild/output/src261112836/src/gmpmgr2v/node_modules/expo/build/Notifications/ExponentNotifications.web.js
2020-02-10T16:39:57.661Z [WARNING]: [16:39:57]  web  Failed to compile.
2020-02-10T16:39:57.661Z [WARNING]: [16:39:57]
2020-02-10T16:39:57.662Z [WARNING]: [16:39:57] Module not found: Error: Can't resolve '../aws-exports' in '/codebuild/output/src261112836/src/gmpmgr2v/src/modules'
2020-02-10T16:39:57.662Z [WARNING]: [16:39:57] Set EXPO_DEBUG=true in your env to view the stack trace.
2020-02-10T16:39:57.673Z [ERROR]: !!! Build failed
2020-02-10T16:39:57.674Z [ERROR]: !!! Non-Zero Exit Code detected
2020-02-10T16:39:57.674Z [INFO]: # Starting environment caching...
2020-02-10T16:39:57.674Z [INFO]: # Environment caching completed

I don't believe there is an issue with my aws-config file, otherwise I would not be able to run it through the expo start --tunnel command.

I believe it is probably not copying aws-config.js to somewhere it should while creating the build.

Has anyone had this problem as well, or know how to address it?

Upvotes: 3

Views: 5631

Answers (3)

burdenless
burdenless

Reputation: 11

I was following the documentation to get started with a React app, and the documentation had a different path for the configuration than what the Expo app init command created by default.

So to fix this, I had to change the import command in my App.js file from:

import config from './aws-exports'

to

import config from './src/aws-exports'

Upvotes: 1

Suhas Deshpande
Suhas Deshpande

Reputation: 725

This file is .gitignore and hence it will not show up in your CI.

Upvotes: 1

rdrgtec
rdrgtec

Reputation: 640

For some reason, in the case of this app, a relative reference to aws-exports file did not work, by using the two dots. Changing to a direct path did the job.

Upvotes: 0

Related Questions