3

Getting this error after adding aws-amplify to the project, Did complete setup for aws-amplify according to the docs, then pod install and react-native run-ios I have also tried changing the import statement as mentioned in the suggestion below error, still doesn't work, Thanks in advance.

  node_modules/@aws-amplify/core/node_modules
  node_modules
  ../node_modules

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  11 |  * and limitations under the License.
  12 |  */
> 13 | import AsyncStorage from '@react-native-async-storage/async-storage';
     |                           ^
  14 | var MEMORY_KEY_PREFIX = '@MemoryStorage:';
  15 | var dataMemory = {};
  16 | /** @class */
    at ModuleResolver.resolveDependency (/Users/monk/Projects/Airbnb/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:234:15)
    at DependencyGraph.resolveDependency (/Users/monk/Projects/Airbnb/node_modules/metro/src/node-haste/DependencyGraph.js:413:43)
    at Object.resolve (/Users/monk/Projects/Airbnb/node_modules/metro/src/lib/transformHelpers.js:317:42)
    at resolve (/Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:629:33)
    at /Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:645:26
    at Array.reduce (<anonymous>)
    at resolveDependencies (/Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:644:33)
    at /Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:329:33
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/monk/Projects/Airbnb/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:24)```
2
  • 1
    Clear the cache and retry Commented Jun 7, 2021 at 2:39
  • 1
    I got that too after updating aws-amplify. Explicitly adding the dependency fixed the problem, although not 100% sure that's the proper way to do it. Commented Jun 7, 2021 at 3:42

5 Answers 5

8

Install Amplify libraries: here,

yarn add @react-native-async-storage/async-storage

After that Try cleaning the project if there is an issue,

rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && yarn cache clean --force && rm -rf ios/build && rm -rf node_modules/
yarn install
rm -rf pods && pod install
Sign up to request clarification or add additional context in comments.

Comments

1

I just deleted the app from the emulator and reinstalled it and it finally worked after a long time of research that led to no emends!

Comments

1

I faced the same issue while I was working with AWS Amplify. I was able to resolve it by just installing the package by firing this command.

npm install @react-native-async-storage/async-storage

Comments

0

delete your node_modules & reinstall your node_modules

Comments

-1

I resolve so - in package.json

"@react-native-community/async-storage": "https://github.com/react-native-async-storage/async-storage",

1 Comment

I don't recommend this at all as every time you do "npm i", it will look for the latest version including those with breaking changes and apply that to your project. This can introduce breaking changes that you might not see immediately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.