【放大】找不到模块:无法解析’./graphql/mutations’的错误解决方案

产生错误

按照AWS Amplify教程的步骤,尝试创建一个Todo应用程序时,出现了以下错误。

Module not found: Can't resolve './graphql/mutations' in '/Users/hoge/huga/src'

由于在错误信息中搜索也找不到解决问题的文章,所以我决定暂时从头开始。

错误发生来源

按照教程进行时,在终端上会有几个地方以问答形式提出问题。

在其中,我认为可能是在下面的页面上发生了一些输入错误。

这里和

amplify add api
? Please select from one of the below mentioned services:
# GraphQL
? Provide API name:
# myapi
? Choose the default authorization type for the API:
# API Key
? Enter a description for the API key:
# demo //ここを何か違うことを書いてしまった気がする
? After how many days from now the API key should expire:
# 7 (or your preferred expiration)
? Do you want to configure advanced settings for the GraphQL API:
# No
? Do you have an annotated GraphQL schema?
# No
? Choose a schema template:
# Single object with fields (e.g., “Todo” with ID, name, description)
? Do you want to edit the schema now?
# Yes

这里

amplify push
? Do you want to generate code for your newly created GraphQL API Yes
? Choose the code generation language target typescript // ここでTypeScriptを選ぶことで以後の質問が変わる
? Enter the file name pattern of graphql queries, mutations and subscriptions src/graphql/**/*.ts
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions Yes
? Enter maximum statement depth [increase from default if your schema is deeply nested] 2
? Enter the file name for the generated code src/API.ts

简而言之

这次与教程不同,我们使用TypeScript × Redux进行创建,基本上默认值没有问题,但要注意相关的问题以及回答。

我们将继续进行教程。

bannerAds