amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Cannot find module '@aws-amplify/react-native' or its corresponding type declarations.

Open dorLottan opened this issue 1 year ago • 6 comments

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Not applicable

Amplify Version

v6

Amplify Categories

Not applicable

Backend

None

Environment information


  Binaries:
    Node: 20.10.0 - /usr/local/opt/node@20/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/opt/node@20/bin/npm
    Watchman: 2023.10.09.00 - /usr/local/bin/watchman

  npmPackages:

...
    @types/react: ^18.2.48 => 18.2.48 
    @types/react-native: ^0.73.0 => 0.73.0 


...
    amazon-cognito-identity-js: ^6.3.7 => 6.3.7 
    amazon-cognito-identity-js/internals:  undefined ()
    aws-amplify: ^6.0.12 => 6.0.12 
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()

...

    react: ^18.2.0 => 18.2.0 
    react-native: 0.72.8 => 0.72.8 (0.73.2)

...
  npmGlobalPackages:
    @aws-amplify/cli: 10.5.2
...
    npm: 10.1.0

Describe the bug

Hello, After updating aws-amplify to version 6, when running my app, I receive the following error message: Cannot find module '@aws-amplify/react-native' or its corresponding type declarations. the app crashes and doesn't run.

I am currently on version: 6.0.12, and I've encountered this issue in earlier versions also (versions above 6).

What additional steps can I take to resolve this issue?

Expected behavior

The application and aws-amplify packages should run.

Reproduction steps

I run the npx pod-install command, tried to delete and recreate the 'node_modules' file, update pods and clear caches.

I don't have @aws-amplify/react-native in my devDependencies on package.json and installing it didn't help.

Downgrading to version 5 helps, but we want to migrate to version 6 in our app. Downgrading to a different lower version (above 6) didn't fix also.

Code Snippet

Cannot find module '@aws-amplify/react-native' or its corresponding type declarations.ts(2307)

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

Example of the error in one of the package files:

screenshot

dorLottan avatar Jan 22 '24 09:01 dorLottan

Hi @dorLottan thank you for opening this issue. Im currently working to reproduce this, in order to assist in that, could you please share your package.json?

Also instead of installing @aws-amplify/react-native in your devDependencies, you should be a adding as a regular dependency.

nadetastic avatar Jan 23 '24 19:01 nadetastic

Hi @dorLottan thank you for opening this issue. Im currently working to reproduce this, in order to assist in that, could you please share your package.json?

Also instead of installing @aws-amplify/react-native in your devDependencies, you should be a adding as a regular dependency.

Sorry for the delay. I added the relevant packages to package.json in the Environment Information section. I removed unrelated packages. Do you need the whole file, or any more packages?

After installing @aws-amplify/react-native as a regular dependency, I am getting a build error and the app doesn't build.

It does still work with version 5 and without the @aws-amplify/react-native dependency.

dorLottan avatar Jan 30 '24 09:01 dorLottan

@dorLottan could you take a look at the Podfile located in the ios directory and update the target value to the following:

platform :ios, 13.0

nadetastic avatar Jan 31 '24 20:01 nadetastic

@dorLottan could you take a look at the Podfile located in the ios directory and update the target value to the following:

platform :ios, 13.0

We can't update to version 13.0 because we are currently using react-native 0.72.9, which doesn't support it yet. Is there another solution?

dorLottan avatar Feb 04 '24 08:02 dorLottan

@dorLottan React Native 0.72.10 supports a minimum version of iOS 12.4 (it appears that they fixed a regression which mistakenly set the minimum version to 13.4). Could you please try updating to RN 72.10 and seeing if you can set the minimum version to 13?

jimblanc avatar Feb 07 '24 17:02 jimblanc

Hi @dorLottan following up here - have you had a chance to review the fix in the comment above?

nadetastic avatar Feb 13 '24 18:02 nadetastic

HI @dorLottan going to close out this issue for now, if you are still facing issues after implementing the fix in @jimblanc comment above, please leave a comment and we can re-open this issue. Thanks!

nadetastic avatar Feb 20 '24 16:02 nadetastic