2

I am trying to setup an apollo project to learn a bit how it works.

I downloaded graphQL nodeJS template from node-graphql-server

I setup a simple angular9 application using apollo-angular

I run the server, and I wanted to autogenerate the type in my angular app.

I ran the code command

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)

I tried to setup some

But I keep getting apollo.config.js

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

and played with the command, but I keep getting the same error over and over.

How can I generate the server types ?

4

1 回答 1

0

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

于 2021-05-10T06:56:01.507 回答