Amplify-ios: Error: Cannot find module 'amplify-frontend-javascript'

Created on 8 Mar 2020  路  11Comments  路  Source: aws-amplify/amplify-ios

Describe the bug
Creating base Amplify project
Error: Cannot find module 'amplify-frontend-javascript'

I didn't see any new files in the root project (IOS) -
amplifyconfiguration.json, awsconfiguration.json and amplifyxc.config

This issue is linked to

https://github.com/aws-amplify/amplify-ios/issues/345

when I built this project for first time then I get this error. If I built it again - got a different error -

Error: Cannot find module 'amplify-frontend-javascript'

To Reproduce
Steps to reproduce the behavior:
I'm following this guide - https://aws-amplify.github.io/docs/ios/start

Step 1: Configure your app
You can use an existing iOS app or create a new iOS app in Swift as per the steps in prerequisite section.

a. From a terminal window, navigate into your Xcode project鈥檚 root application directory and run the following commands:

$ cd ./YOUR_PROJECT_FOLDER
$ pod init
b. Open the created Podfile in a text editor and add the pods for the core Amplify Framework components.

target :'YOUR-APP-NAME' do
    use_frameworks!

    pod 'amplify-tools'

    pod 'Amplify'
    pod 'AWSPluginsCore'
    pod 'AmplifyPlugins/AWSAPIPlugin'

    # other pods
end

c. Install dependencies by running the following command:

pod install --repo-update
d. Close your Xcode project and reopen it using ./YOUR-PROJECT-NAME.xcworkspace file. Remember to always use ./YOUR-PROJECT-NAME.xcworkspace to open your Xcode project from now on.

e. Build your Xcode project.

Once the build is successful, three files are generated:

amplifyconfiguration.json and awsconfiguration.json: Rather than configuring each service through a constructor or constants file, the Amplify Framework for iOS supports configuration through centralized files called amplifyconfiguration.json and awsconfiguration.json which define all the regions and service endpoints to communicate.

Which AWS service(s) are affected?

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment(please complete the following information):

  • SDK Version: [e.g. 2.6.29]
  • Dependency Manager: pods
  • Swift Version : [e.g. 4.0]

Device Information (please complete the following information):

  • Device: [e.g. iPhone6, Simulator]
  • iOS Version: [e.g. iOS 11.4]
  • Specific to simulators:

Additional context
Add any other context about the problem here.

bug build

All 11 comments

Hi @prmacias,

I tried to reproduce your error, but was unable to do so. We suspect you might have an older version of node/npm/amplify. On my box, I have running the following versions:

$ node --version
v10.16.3
$ npm --version
6.13.1
$ amplify --version
4.13.3

I don't think I have the latest bleeding-edge, but could you check to see which versions of these tools you have on your machine?

@wooj2

See - https://github.com/aws-amplify/amplify-cli/issues/3580#issuecomment-596637253

I think that is my issue. I'll check on it and let you all know soon.

@prmacias were you able to resolve?

@kneekey23 not yet, got occupied with something else. I'll try to get it done by tomorrow.

@kneekey23

I managed to install the amplify without any issues but there are errors related to predictions set up.

No such module 'AWSPredictionsPlugin'

and there are some issues in ConvertConfiguration, and IdentifyConfiguration files

my pod file -

```
pod 'amplify-tools'

pod 'Amplify'
pod 'AmplifyPlugins'
pod 'AWSPluginsCore'
pod 'CoreMLPredictionsPlugin'
pod 'AWSPredictionsPlugin'
pod 'AWSMobileClient', '~> 2.12.0'
```

hi @prmacias I am not able to reproduce your issue. did you run pod install --repo-update and did you add import AWSPredictionsPlugin to the top of the AppDelegate file? I tried to go through the getting started guide with the above pods you gave first and then switch to the podfile you just gave and no luck. I created a sample app in my github repo here, can you try using that to help you get set up?

@kneekey23

I got your repo pulled and I'm having trouble updating the pod -

pod install --repo-update

[!] No podspec found forAWSPluginsCorein~/Projects/Amplify/amplify-ios``

I updated my pod and still getting this error. Something's amiss in my setup. I double checked the - Ensure you have installed and configured the Amplify CLI and library. What do you mean by library? I installed CLI again and configured it but still getting this error.

not sure why you have this
:path => '~/Projects/Amplify/amplify-ios'

I don't have that path configured for my app.

I removed the path and it seems it's working. Let me see if I can run this app in my iphone.

I inited the amplify and it should be creating the updated files (3 files of amplify)

Still getting error -

error: /Users/user/Documents/workspace/SwiftPredictions/AmplifyPredictionsSampleApp/awsconfiguration.json: No such file or directory (in target 'AmplifyPredictionsSampleApp' from project 'AmplifyPredictionsSampleApp')

It's odd because I see the file exist in the Xcode but it's not recognizing the file for some reason. I cleaned the data and built it again but still getting this error. I restarted the xcode and still getting this error as well.

It looks like the xcode didn't refresh the updated amplify files (your files had the server which is west-2 and mines' east1) The amplify should include the refreshed files (check files to see if it is updated?).

I built it again and it is fine but got the error -

Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: PluginError: The 'Region' key is missing from the configuration

I have the region here -

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "predictions": {
        "plugins": {
            "awsPredictionsPlugin": {
                "defaultRegion": "us-east-1",
                "convert": {
                    "transcription": {
                        "language": "en-US",
                        "region": "us-east-1",
                        "defaultNetworkPolicy": "auto"
                    }
                }
            }
        }
    }
}

Stepping out - need a break

hi @prmacias two things here. 1. the reason I had that path in my Podfile was because I was locally testing so yes please remove it as you did 2. Delete all the amplify files from the project before running amplify init and then try again. Let me know if that works for you.

@kneekey23

It worked - thanks - I will compare your work with my app to see what's going on. Thanks again!

Closing this issue, please feel free to reopen it if you have further issues.

Was this page helpful?
0 / 5 - 0 ratings