【发布时间】:2020-02-04 06:11:26
【问题描述】:
运行apollo client:codegen 时出现以下错误:
✔ Loading Apollo Project
✖ Generating query files with 'typescript' target
→ Can only create NonNull of a Nullable GraphQLType but got: ID.
Error: Can only create NonNull of a Nullable GraphQLType but got: ID.
at invariant (~/Code/humu/node_modules/graphql/jsutils/invariant.js:18:11)
at new GraphQLNonNull (~/Code/humu/node_modules/graphql/type/definition.js:779:84)
at Object.typeFromASTImpl (~/Code/humu/node_modules/graphql/utilities/typeFromAST.js:39:25)
at variables.map.node (~/Code/humu/node_modules/apollo-codegen-core/lib/compiler/index.js:73:36)
at Array.map (<anonymous>)
at Compiler.compileOperation (~/Code/humu/node_modules/apollo-codegen-core/lib/compiler/index.js:71:75)
at Object.compileToIR (~/Code/humu/node_modules/apollo-codegen-core/lib/compiler/index.js:15:44)
at Object.generate [as default] (~/Code/humu/node_modules/apollo/lib/generate.js:78:36)
at write (~/Code/humu/node_modules/apollo/lib/commands/client/codegen.js:67:54)
at Task.task (~/Code/humu/node_modules/apollo/lib/commands/client/codegen.js:86:46)
为什么会这样?该错误听起来好像架构有两个非空运算符(例如:ID!!)或类似的,但在我的架构文件中我没有。
【问题讨论】:
标签: graphql-js