Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apollo-IOS build error "Command PhaseScriptExecution failed with a nonzero exit code"

I'm trying to build a sample Apollo-IOS on Xcode 10. I have followed all the step describe in the docs:

Apolo-IOS getting started

There is an error as bellow

++ 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

Seem like my Queries.graphql and schema.json is in the correct place and can be found by the run script. Anyone know what is the error and how to resolve (I have updated to latest Apollo-Cli which is 1.9.2)

like image 212
Lê Khánh Vinh Avatar asked Jan 01 '23 16:01

Lê Khánh Vinh


1 Answers

I had the same problem.
I checkout the Run script only when installing and I resolved the problem. Check that you tick on that checkbox Run script only when installing enter image description here

like image 172
Angel F Syrus Avatar answered May 30 '23 16:05

Angel F Syrus