Reputation: 2815
I am running a Cordova Build task in VSTS that builds for iOS the signing files attached:
However, when I execute the task, I get the following error:
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)
Tracing back through the code of child_process, I am pretty confident this error is occurring because the file argument is not a string. Below is a snippet of the call chain:
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');
Indeed that does appear to be the case. The first argument of spawn(), createKeychain, is an object and not a string. I get the following when I print the object out:
{ [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 ] }
I'm sure I am missing something, but this one feels like it's a bug within the Cordova Build extension.
FYI Node: 8.9.1, NPM: 5.5.1, Cordova Build: 1.3.11
Upvotes: 3
Views: 2384
Reputation: 196
had exactly the same problem... it was caused by the NodeJS Version (8.x) on the agent. Downgraded to 6.x and after that, the step was working ;)
It is also possible, to add a "Use Node 6.x" Task in your build..
Upvotes: 2