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

I am getting the following error (see below) when I use d2 --help using Big Sur with M1 chip, node v16.13.1 and yarn 1.22.17 Any ideas??

node:internal/validators:119
throw new ERR_INVALID_ARG_TYPE(name, ‘string’, value);
^

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/mmwebaze/.config/yarn/global/node_modules/@dhis2/cli-helpers-engine/lib/createModuleLoader.js:17:44)
at builder (/Users/mmwebaze/.config/yarn/global/node_modules/@dhis2/cli/src/index.js:6:24)
at builder (/Users/mmwebaze/.config/yarn/global/node_modules/@dhis2/cli-helpers-engine/lib/namespace.js:13:21)
at module.exports (/Users/mmwebaze/.config/yarn/global/node_modules/@dhis2/cli-helpers-engine/lib/makeEntryPoint.js:16:5)
at Object. (/Users/mmwebaze/.config/yarn/global/node_modules/@dhis2/cli/bin/d2:8:1)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10) {
code: ‘ERR_INVALID_ARG_TYPE’
}

@Michael_Mwebaze, thank you for your question, and your patience! Have you tried updating d2 by running the command: yarn global add @dhis2/cli ?

Hope it helps! Please let me know if you still have the same issue even after running the update, thanks!

Hi AL-Gassim,

I am getting the same error on Mac with M1 chip, node v16.13 and Yarn v1.22.1 when I use d2 --help after installing dhis2/cli in both ways:

yarn global add @dhis2/cli

# or

npm install --global @dhis2/cli

error:

node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

Please let me know how I can move forward from here.

Welcome to the community! :tada:

I’m sorry you are facing this issue too! I think I have faced similar issues and repeating the installation process seemed to work, so please try to run these again in an elevated terminal (with administrator rights):

  1. npm install -g npm@8.3.0
    and don’t use the audit fix, please, I read it causes more errors (unless someone knows exactly when and why to use it.)
  2. npm install --global yarn
  3. yarn global add @dhis2/cli
  4. try the command: d2 --help

Hope it works! Thanks!

This doesn’t fix anything on M1 chip laptop.

Hello @Gassim

May I know what version of yarn and node you are using? I’m using yarn version 1.22.15 and node v16.13.0 and I also get the same error. I use ubuntu 20.04 OS.

I was also getting this error, I tried re-installing the @dhis2/cli package as outlined, but now the package install fails with the message:
error Couldn't find package "react-query@^3.13.11" required by "@dhis2/app-service-data@3.2.7" on the "npm" registry.

Perhaps this is more than just an M1 issue?

The error I was getting when trying to install the @dhis2/cli package was resolved by using the default version of npm (8.1.0) that comes with node v16.13.0 from nvm. I am still getting the error Micheal highlighted though when I try and actual use the cli package.

Sorry @Michael_Mwebaze that was the last command to test if steps 1 → 3 worked. ( :

@nnkogift: Thanks! For me it’s all working fine though but I’m using Windows 10.
npm --version: 8.3.0
yarn --version: 1.22.1
node -v: v16.13.0

@plinnegan Maybe try and update npm to 8.3.0 . I’m not getting any of these errors.

@Gassim unfortunately the @dhis2/cli package does not even install with node 8.3.0 on mac (no M1 chip though) (That’s when I got the installation error). Swapping to 8.1.0 allows me to install the package, but it still fails to run every time from the cli with the same error message Michael originally highlighted.

1 Like

Right! This might be the reason why I’m not seeing any errors. Thanks @plinnegan!

I am using the following:

npm --version: 8.3.0
yarn --version: 1.22.17
node -v: 16.13.1

I have tried node -v: 17.3.0 as well but still get the same error

Thanks

Hi guys,

Looks like this is an issue with the latest version of d2. We’ll fix this ASAP but in the meantime you may have luck installing an earlier version.

3 Likes

Thanks @mediremi! In the meantime, @Michael_Mwebaze @cyen @nnkogift and @plinnegan will be mentioned in the copmonthly as bug hunters! Thanks for your patience! (:

1 Like

Thanks for the quick response guys :gift_heart:

1 Like

I’m facing the sam issue. :innocent:

@Michael_Mwebaze @cyen @nnkogift @plinnegan @Ahme7d this issue is now fixed with d2 v4.2.1.

To install it just run yarn global add @dhis2/cli.

Do let me know if you have any further issues and apologies for the inconvenience.

4 Likes

Can confirm it’s working well for me now thanks!

1 Like

Thanks, Now it seems to work fine. :+1: :+1: :+1:

1 Like

It works for me too. Thanks. :pray:t5:

1 Like