我在VSTS中运行Cordova Build任务,为iOS构建附加的签名文件:
但是,当我执行任务时,出现以下错误:
TypeError: "file" argument must be a non-empty string
at normalizeSpawnArguments (child_process.js:383:11)
at spawnSync (child_process.js:519:38)
at /Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/lib/xcode-task-utils.js:55:31
at _fulfilled (/Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/node_modules/q/q.js:816:13)
at /Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/node_modules/q/q.js:877:14
at runSingle (/Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/node_modules/q/q.js:137:13)
at flush (/Users/dummyuser/Desktop/dev/agent/_work/_tasks/CordovaBuild_70e94267-15dc-434d-8973-023d766825d7/1.3.11/node_modules/q/q.js:125:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
追溯child_process的代码,我非常有信心发生此错误,因为file参数不是字符串。以下是调用链的片段:
的xcode-util的-task.js
var spawnResult = spawn(createKeychain, createKeychainArgs, { stdio: "inherit" });
child_process.js
function spawnSync() {
var opts = normalizeSpawnArguments.apply(null, arguments);
...
function normalizeSpawnArguments(file, args, options) {
if (typeof file !== 'string' || file.length === 0)
throw new TypeError('"file" argument must be a non-empty string');
事实确实如此。 spawn()的第一个参数createKeychain是一个对象,而不是一个字符串。当我打印出对象时,我得到以下内容:
{ [String: '/bin/bash']
stdout: '/bin/bash',
stderr: null,
code: 0,
cat: [Function: bound ],
exec: [Function: bound ],
grep: [Function: bound ],
head: [Function: bound ],
sed: [Function: bound ],
sort: [Function: bound ],
tail: [Function: bound ],
to: [Function: bound ],
toEnd: [Function: bound ],
uniq: [Function: bound ] }
我确定我错过了一些东西,但这个感觉就像是Cordova Build扩展中的一个错误。
FYI 节点:8.9.1,NPM:5.5.1,Cordova Build:1.3.11
答案 0 :(得分:1)
有完全相同的问题......它是由代理上的NodeJS版本(8.x)引起的。降级到6.x,之后,该步骤正在运行;)
还可以添加"使用节点6.x"你的构建中的任务..