You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After downloading my schema, I try to generate the TypeScript types using:
apollo codegen:generate --schema=./src/data/schema.json --target=typescript
But this gives the following error:
$ apollo codegen:generate --schema=./src/data/schema.json --target=typescript
✔ Loading Apollo config
✔ Scanning for GraphQL queries (663 found)
✖ Generating query files with 'typescript' target
→ Cannot query field "machines" on type "Query"
GraphQLError: Cannot query field "machines" on type "Query"
at Compiler.compileSelection (~/Projects/manager-ui/node_modules/apollo-codegen-core/lib/compiler/index.js:120:27)
at selections.selectionSetNode.selections.map.selectionNode (~/Projects/manager-ui/node_modules/apollo-codegen-core/lib/compiler/index.js:106:76)
at Array.map (<anonymous>)
at Compiler.compileSelectionSet (~/Projects/manager-ui/node_modules/apollo-codegen-core/lib/compiler/index.js:106:18)
at Compiler.compileOperation (~/Projects/manager-ui/node_modules/apollo-codegen-core/lib/compiler/index.js:86:32)
at Object.compileToIR (~/Projects/manager-ui/node_modules/apollo-codegen-core/lib/compiler/index.js:15:44)
at Object.generate [as default] (~/Projects/manager-ui/node_modules/apollo/lib/generate.js:74:36)
at Task.task (~/Projects/manager-ui/node_modules/apollo/lib/commands/codegen/generate.js:98:64)
at Promise.resolve.then.then.skipped (~/Projects/manager-ui/node_modules/listr/lib/task.js:167:30)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I can resolve this issue by manually removing node_modules/apollo/node_modules/graphql directory. So it appears that the version of graphql (14.0.2) I am running is conflicting with Apollo CLI
After downloading my schema, I try to generate the TypeScript types using:
But this gives the following error:
I only have one
GetMachines.graphql
which is:The generated
schema.json
contains thismachines
:The text was updated successfully, but these errors were encountered: