D2 --help throw new ERR_INVALID_ARG_TYPE(name, 'string', value);

Works fine with me too.

Thanks

1 Like

@mediremi @Gassim I am now seeing a similar issue with the d2 app command (now on the latest version 4.2.1):

plinnegan@Peters-MacBook-Pro 3-learning % node -v
v16.13.0
plinnegan@Peters-MacBook-Pro 3-learning % npm -v
8.3.0
plinnegan@Peters-MacBook-Pro 3-learning % yarn -v
1.22.17
plinnegan@Peters-MacBook-Pro 3-learning % yarn global list
yarn global v1.22.17
...
info "@dhis2/cli@4.2.1" has binaries:
   - d2

However if I try and run d2 app --version I get the following:

plinnegan@Peters-MacBook-Pro 3-learning % d2 app --version
/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli/node_modules/yargs/yargs.js:1172
      else throw err
           ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Object.resolve (node:path:1098:7)
    at module.exports (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli-helpers-engine/lib/createModuleLoader.js:17:44)
    at builder (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli-app/src/index.js:6:24)
    at Object.builder (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli-helpers-engine/lib/namespace.js:13:21)
    at Object.runCommand (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli/node_modules/yargs/lib/command.js:188:35)
    at Object.parseArgs [as _parseArgs] (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli/node_modules/yargs/yargs.js:1087:30)
    at Object.parse (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli/node_modules/yargs/yargs.js:551:19)
    at module.exports (/Users/plinnegan/.config/yarn/global/node_modules/@dhis2/cli/node_modules/@dhis2/cli-helpers-engine/lib/makeEntryPoint.js:64:11) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Does the cli need another update or am I missing something?
Many thanks in advance!

1 Like

@plinnegan oops looks like I forgot to explicitly bump the dependencies for @dhis2/cli-app :sweat_smile:

The following should fix things:

  1. yarn global add @dhis2/cli-helpers-engine@latest
  2. yarn global remove @dhis2/cli
  3. yarn global add @dhis2/cli
2 Likes

Working now! Thanks for the quick fix @mediremi! :blush:

1 Like