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’
}
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):
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.)
May I know what version of yarn and node you are using? I’m using yarn version 1.22.15 and nodev16.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.
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.
@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.