【问题标题】:Apollo Codegen No operations or fragments found to generate code forApollo Codegen 没有找到生成代码的操作或片段
【发布时间】:2020-08-19 16:53:07
【问题描述】:

我正在尝试设置一个 apollo 项目以了解它的工作原理。

我从node-graphql-server下载了graphQL nodeJS模板

我使用 apollo-angular 设置了一个简单的 angular9 应用程序

我运行服务器,我想在我的 Angular 应用程序中自动生成类型。

我运行了代码命令

apollo codegen:generate --endpoint=http://localhost:500/ --target=typescript --globalTypesFile=./src/app/__generated__/globalTypes.ts

  × Generating query files with 'typescript' target
    → No operations or fragments found to generate code for.
Error: No operations or fragments found to generate code for.
    at write (C:/Users/feder/AppData/Roaming/npm-cache/_npx/3188/node_modules/apollo/lib/commands/client/codegen.js:72:39)
    at Task.task (C:/Users/feder/AppData/Roaming/npm-cache/_npx/3188/node_modules/apollo/lib/commands/client/codegen.js:98:46)

我尝试设置一些

但我不断收到 apollo.config.js

module.exports = {
    client: {
      includes: [__dirname+'/src/graphql/**'],
      service: {
        name: "localhost",
        url: "https://localhost:500",
      }
    }
}

并使用该命令进行操作,但我一遍又一遍地收到相同的错误。

如何生成服务器类型?

【问题讨论】:

    标签: angular graphql apollo prisma-graphql apollo-angular


    【解决方案1】:

    当我将项目放在带有“哈希”符号“#test_folder”的文件夹中时,我遇到了类似的问题。一旦我改变了它,项目就会按预期生成。

    【讨论】:

      猜你喜欢
      • 2019-07-19
      • 2021-09-02
      • 1970-01-01
      • 2019-07-30
      • 2020-12-21
      • 2014-08-08
      • 1970-01-01
      • 2017-04-15
      • 2020-08-12
      相关资源
      最近更新 更多