作者:滴答滴答箫雨伞_335 | 来源:互联网 | 2022-12-11 19:48
如何解决《ApolloiOS:Command/bin/sh失败,退出代码为1|命令PhaseScriptExecution失败,出现非零退出代码》经验,为你挑选了1个好方法。
我按照Apollo的安装教程进行操作.而且我完全相信我按照安装教程中的描述完成了所有工作.但是,在项目构建期间,我收到了编译器错误,如:
TypeError:无法读取未定义的属性"length"
at Object.yargs.command.command.command.argv [as handler] (/usr/local/lib/node_modules/apollo-codegen/src/cli.js:186:17)
at Object.runCommand (/usr/local/lib/node_modules/apollo- codegen/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:1013:30)
at Object.get [as argv] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:957:21)
at Object. (/usr/local/lib/node_modules/apollo-codegen/lib/cli.js:197:5)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
命令/ bin/sh失败,退出代码为1
和
++ exec apollo-codegen生成--schema schema.json --output API.swift
TypeError:无法读取未定义的属性"length"
at Object.yargs.command.command.command.argv [as handler] (/usr/local/lib/node_modules/apollo-codegen/src/cli.js:186:17)
at Object.runCommand (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:1013:30)
at Object.get [as argv] (/usr/local/lib/node_modules/apollo-codegen/node_modules/yargs/yargs.js:957:21)
at Object. (/usr/local/lib/node_modules/apollo-codegen/lib/cli.js:197:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
命令PhaseScriptExecution失败,出现非零退出代码
为什么我收到这个错误?
1> Roman Romane..:
在花了很多时间并进行搜索后,我理解为什么会出现错误.坦克到@NiltiakSivad的回答是关于GitHub问题的讨论
Apollo脚本试图在项目文件夹中找到扩展名为.graphql的文件,并带有适当的查询或突变.如果它们不存在,可能会出现上述错误.我认为Apollo团队应该在安装教程中警告他们的观众这样的可能情况!
因此,为了成功运行项目,请确保:
你的Apollo版本与apollo-codegen兼容
您正确添加了Apollo脚本
您在项目文件夹中有schema.json
您在项目文件夹中包含扩展名.graphql的文件,该文件夹包含适当的schema.json 查询或变异