我正在尝试在Xcode 10上构建示例Apollo-IOS。我已经按照文档中描述的所有步骤进行操作:
出现以下错误
timeFormat
好像我的++ npx --no-install apollo codegen:generate --queries=./GraphQL/Queries.graphql --schema=schema.json API.swift --passthroughCustomScalars
[?25l[22:26:11] Loading Apollo config [started]
[22:26:11] Loading Apollo config [completed]
[22:26:11] Resolving GraphQL document sets and dependencies [started]
[22:26:11] Scanning for GraphQL queries (1 found) [title changed]
[22:26:11] Scanning for GraphQL queries (1 found) [completed]
[22:26:11] Generating query files [started]
[22:26:11] Generating query files with 'swift' target [title changed]
[22:26:11] Generating query files with 'swift' target [failed]
[22:26:11] → Cannot read property 'getType' of undefined
[?25hTypeError: Cannot read property 'getType' of undefined
at typeFromAST (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/graphql/utilities/typeFromAST.js:41:19)
at TypeInfo.enter (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/graphql/utilities/TypeInfo.js:153:74)
at Object.enter (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/graphql/language/visitor.js:363:16)
at Object.visit (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/graphql/language/visitor.js:254:26)
at getValidationErrors (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/apollo/lib/validation.js:21:15)
at Object.validateQueryDocument (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/apollo/lib/validation.js:26:30)
at Object.generate [as default] (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/apollo/lib/generate.js:19:18)
at Task.task (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/apollo/lib/commands/codegen/generate.js:98:64)
at Promise.resolve.then.then.skipped (/Volumes/Data/OneDrive/IOS/Source/GraphQL/JediArchives/JediArchives-Final/node_modules/listr/lib/task.js:167:30)
[?25hCommand PhaseScriptExecution failed with a nonzero exit code
和Queries.graphql
在正确的位置,可以通过运行脚本找到。任何人都知道错误是什么以及如何解决(我已将最新的schema.json
更新为1.9.2)