AWS Amplify错误处理找不到模块“graphql/language/ast”的声明文件

发生的问题

在构建执行时出现以下错误

1:30 Could not find a declaration file for module 'graphql/language/ast'. 

  Try `npm install @types/graphql` if it exists or add a new declaration (.d.ts) file co
ntaining `declare module 'graphql/language/ast';`
  > 1 | import { DocumentNode } from 'graphql/language/ast';
      |                              ^
    2 | export interface GraphQLOptions {
    3 |     query: string | DocumentNode;
    4 |     variables?: object;

 ERROR  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! front@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the front@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

处理方法1

执行以下命令进行构建,但结果不成功。

npm install @types/graphql

应对2

删除@types后安装并构建成功。

npm install graphql
广告
将在 10 秒后关闭
bannerAds