gpt4 book ai didi

react-native - 无法解析模块@react-native-async-storage/async-storage

转载 作者:行者123 更新时间:2023-12-05 01:29:21 25 4
gpt4 key购买 nike

将 aws-amplify 添加到项目后出现此错误,是否根据文档完成了 aws-amplify 的设置,然后是 pod install 和 react-native run-ios我也尝试过按照下面的错误建议更改导入语句,但仍然不起作用,在此先感谢。

  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)```

最佳答案

安装 Amplify 库:here ,

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

之后,如果出现问题,请尝试清理项目,

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

关于react-native - 无法解析模块@react-native-async-storage/async-storage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67865267/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com