简体   繁体   English

如何修复找不到模块“./aws-export”或其对应的类型 declarations.ts (2307)

[英]How to fix Cannot find module './aws-export' or its corresponding type declarations.ts (2307)

I am trying to integrate my project with aws (amazon web service ) After I initialize aws globally I decided to create a project call ELab by using the我正在尝试将我的项目与 aws(亚马逊 web 服务)集成 在我全局初始化 aws 之后,我决定使用

following command以下命令

amplify init

and also using the following command to configure it并使用以下命令对其进行配置

npm install aws-amplify @aws-amplify/ui-react 

then I add this to my App.tsx file然后我将其添加到我的 App.tsx 文件中

import Amplify from 'aws-amplify'
import config from './aws-exports' // error the /aws-exports.js was not generated
Amplify.configure(config)

After all those configuration aws fail to generate the aws-exports.js configuration file在所有这些配置 aws 无法生成 aws-exports.js 配置文件之后

is there any to resolve this issues thank you in advance有没有解决这个问题的办法 提前谢谢

See this doc看这个文档

https://docs.amplify.aws/start/getting-started/setup/q/integration/angular/#install-amplify-libraries https://docs.amplify.aws/start/getting-started/setup/q/integration/angular/#install-amplify-libraries

Strictly typing aws-exports If you have TypeScript strict mode on and see the error严格输入 aws-exports 如果您开启了 TypeScript 严格模式并看到错误

Create a aws-exports.d.ts file on the same level as aws-exports with the following content:使用以下内容在与 aws-exports 相同级别上创建一个 aws-exports.d.ts 文件:

declare const awsmobile: Record<string, any>
export default awsmobile;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM