The "file" argument must be of type string. Received type object

Hi everyone,

i’m having tons of troubles with this kind of error:

16:16:28      [exec] `au build` is an alias of the `npm run build:dev`, you may use either of those; see README for more details.
16:16:28      [exec] {
16:16:28      [exec]   uid: 0,
16:16:28      [exec]   name: '_default',
16:16:28      [exec]   branch: false,
16:16:28      [exec]   error: TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
16:16:28      [exec]       at validateString (internal/validators.js:112:11)
16:16:28      [exec]       at normalizeSpawnArguments (child_process.js:398:3)

Conditions are:

This error is only on Jenkins automatic build, no problem in local environment, no problem even trying to build by line command, the only situation where i’ve this problem is when jenkins call the ant-script who call “${cli} build --env prod”

this is my aurelia.json

{
  "name": "hhweb",
  "type": "project:application",
  "paths": {
    "root": "src",
    "resources": "resources",
    "elements": "resources/elements",
    "attributes": "resources/attributes",
    "valueConverters": "resources/value-converters",
    "bindingBehaviors": "resources/binding-behaviors"
  },
  "transpiler": {
    "id": "babel",
    "fileExtension": ".js"
  },
  "build": {
    "options": {
      "server": "dev",
      "extractCss": "prod",
      "coverage": false
    }
  },
  "platform": {
    "hmr": false,
    "open": true,
    "port": 9000,
    "host": "localhost",
    "output": "dist"
  }
}

any suggestions?

Thank you

Full error log from jenkins pls.

17:44:18 [startBuildActivity] Started build activity "Application Build" for build result "#95".
17:44:19 
17:44:19 build_HH_channels:
17:44:19      [echo] dir origin => ../Channels.UK.Handheld.JS/hhweb
17:44:19      [echo] dir.target => ../Channels.UK.Handheld.BFF/WebContent/transfereticket
17:44:19      [echo] Cleaning...
17:44:19     [unzip] Expanding: /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules.zip into /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb
17:46:06      [echo] Setting permissions...
17:46:07      [echo] Building client app ...
17:46:07      [echo] cleaning scripts of target...
17:46:07      [echo] cleaning scripts of origin and creating folders for building...
17:46:07     [mkdir] Created dir: /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/dist
17:46:07     [mkdir] Created dir: /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/dist/aureliaScript
17:46:07     [mkdir] Created dir: /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/dist/css
17:46:07      [echo] building production environment...
17:46:07      [echo] exec ../../Common.Technical.Javascript.Tools/nodeJS_8.9/node-v12.13.0-linux-x64/bin/node 
17:46:07      [exec] Local aurelia-cli v2.0.3
17:46:08      [exec] Starting '_default'...
17:46:08      [exec] `au build` is an alias of the `npm run build:dev`, you may use either of those; see README for more details.
17:46:08      [exec] {
17:46:08      [exec]   uid: 0,
17:46:08      [exec]   name: '_default',
17:46:08      [exec]   branch: false,
17:46:08      [exec]   error: TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
17:46:08      [exec]       at validateString (internal/validators.js:112:11)
17:46:08      [exec]       at normalizeSpawnArguments (child_process.js:398:3)
17:46:08      [exec]       at spawn (child_process.js:534:16)
17:46:08      [exec]       at /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules/aurelia-cli/lib/package-managers/base-package-manager.js:15:19
17:46:08      [exec]       at new Promise (<anonymous>)
17:46:08      [exec]       at exports.NPM.run (/opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules/aurelia-cli/lib/package-managers/base-package-manager.js:14:12)
17:46:08      [exec]       at _default (/opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/aurelia_project/tasks/build.js:6:22)
17:46:08      [exec]       at bound (domain.js:420:14)
17:46:08      [exec]       at runBound (domain.js:433:12)
17:46:08      [exec]       at asyncRunner (/opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules/async-done/index.js:55:18) {
17:46:08      [exec]     code: 'ERR_INVALID_ARG_TYPE'
17:46:08      [exec]   },
17:46:08      [exec]   duration: [ 0, 9304609 ],
17:46:08      [exec]   time: 1630079168308
17:46:08      [exec] }
17:46:08      [exec] TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
17:46:08      [exec]     at validateString (internal/validators.js:112:11)
17:46:08      [exec]     at normalizeSpawnArguments (child_process.js:398:3)
17:46:08      [exec]     at spawn (child_process.js:534:16)
17:46:08      [exec]     at /opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules/aurelia-cli/lib/package-managers/base-package-manager.js:15:19
17:46:08      [exec]     at new Promise (<anonymous>)
17:46:08      [exec]     at exports.NPM.run (/opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules/aurelia-cli/lib/package-managers/base-package-manager.js:14:12)
17:46:08      [exec]     at _default (/opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/aurelia_project/tasks/build.js:6:22)
17:46:08      [exec]     at bound (domain.js:420:14)
17:46:08      [exec]     at runBound (domain.js:433:12)
17:46:08      [exec]     at asyncRunner (/opt/ibm/ws_Channels_C2C_8.6.0/Channels.UK.Handheld.JS/hhweb/node_modules/async-done/index.js:55:18) {
17:46:08      [exec]   code: 'ERR_INVALID_ARG_TYPE'
17:46:08      [exec] }

Looks like from npm package async-done. But from the code of current async-done v1.3.2, I got no idea why it complains on that line.

If you can get into the jenkins box, you can check the version of the async-done package in its package.json (or npm ls async-done in the project folder).

From the log, I can see jenkins is running nodejs v12.13.0, I tried that nodejs version, build seems fine.