amazon-web-services - 使用 AWS 的全栈项目,运行 yarn ios,出现错误:这些文件都不存在:从 'aws-amplify' 导入 Amplify;从 './aws-exp 导入配置
问题描述
我正在尝试使用 AWS 建立一个完整的堆栈项目,但是当我运行时
yarn ios
我收到此错误:
Unable to resolve module ./aws-exports from /Users/username/Desktop/folderLocation/index.js:
None of these files exist:
* aws-exports(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
* aws-exports/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
8 |
9 | import Amplify from 'aws-amplify';
> 10 | import config from './aws-exports';
| ^
11 | Amplify.configure(config);
12 |
13 | AppRegistry.registerComponent(appName, () => App);
RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start
0x0
我使用 Amplify CLI 创建项目,其中:
amplify init
它在 src 目录中创建了一个名为 amplify 的顶级目录和一个名为 aws-exports.js 的文件。
我安装了放大库
npm install aws-amplify aws-amplify-react-native amazon-cognito-identity-js @react-native-community/netinfo
我跑了:npx pod-install ios
在 index.js 中,我输入:
import Amplify from 'aws-amplify';
import config from './aws-exports';
Amplify.configure(config);
我在一些博客(https://github.com/aws-amplify/amplify-js/issues/669)上看到我应该运行:
npm install -g awsmobile-cli@latest
因为“也许如果您使用的是旧版本的 awsmobile-cli。” 但这不会安装,我遇到了一堆错误,例如:
Missing write access to /usr/local/lib/node_modules
The operation was rejected by your operating system.
任何帮助将不胜感激,谢谢
解决方案
推荐阅读
- java - 在 Spring Boot OAuth2 服务器上验证 Cron 作业
- mysql - 在 laravel eloquent 中使用带有 group by 的子查询
- python - 运行分离的散景服务器
- bdd - 是否可以在 specflow 中为场景生成示例表?
- angular - 量角器:只能为页面启用虚拟时间,不能为工作人员启用
- dockerfile - Docker distroless image 如何将自定义证书添加到信任库?
- python - 以 10 为底的 int() 的无效文字:Python 中的“x”错误?
- r - 在 R 中使用 lapply 生成具有不同参数的随机数
- firebase - Firebase 存储规则在 Firestore 文档上查找数据?
- c# - IBM MQ with C# 如何将消息头更改为 MQHRF