运行iOS脚本会导致以下错误。有什么建议吗?
示例项目
会发生这种情况 /bin/sh -c /Users/aryan.ghassemi/Library/Developer/Xcode/DerivedData/FrontPage-djowwaikrpnoghhjhlxriwamylsv/Build/Intermediates/FrontPage.build/Debug-iphonesimulator/FrontPage.build/Script-9F672F2E1DB0053600974171.sh
/Users/aryan.ghassemi/.nvm/versions/node/v4.2.6/lib/node_modules/apollo-codegen/lib/cli.js:41
const [name, value] = header.split(/\s*:\s*/);
^
SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
The version of Apollo.framework in your project requires apollo-codegen 0.15, but an unknown older version seems to be installed. Installing...
/Users/aryan.ghassemi/.nvm/versions/node/v4.2.6/bin/apollo-codegen -> /Users/aryan.ghassemi/.nvm/versions/node/v4.2.6/lib/node_modules/apollo-codegen/lib/cli.js
+ apollo-codegen@0.15.2
updated 1 package in 1.363s
++ exec apollo-codegen generate ./PostListViewController.graphql ./PostTableViewCell.graphql --schema schema.json --output API.swift
/Users/aryan.ghassemi/.nvm/versions/node/v4.2.6/lib/node_modules/apollo-codegen/lib/cli.js:41
const [name, value] = header.split(/\s*:\s*/);
^
SyntaxError: Unexpected token [
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
Command /bin/sh failed with exit code 1
答案 0 :(得分:0)
脚本在旧版本的节点上运行,更新到6.9修复了问题