Adaptor installation issue with dhis2

Hi everyone
I am trying to export data to dhis2 with openFN jobs. But I am getting an error. Is there anyone who can help me please?
Here is the command I tried to run and its response.
tsegay@tsegay-ThinkPad-L540:~/openfncodes$ openfn exportPecients.js -i -a dhis2 -s dhis22.json -o dhis2output.json --no-strict-output
[CLI] :heavy_check_mark: Installing packages…
[CLI] :heavy_check_mark: Installation complete in 3.718s
[CLI] :heavy_check_mark: Loaded state from dhis22.json
[CLI] ✘ Failed to load adaptor typedefs from path /tmp/openfn/repo/node_modules/@openfn/language-dhis2_3.2.8
[CLI] ✘ Error: ENOENT: no such file or directory, open ‘/tmp/openfn/repo/node_modules/@openfn/language-dhis2_3.2.8/package.json’
[CLI] :heavy_check_mark: Compiled job from exportPecients.js
triggerUncaughtException(err, true /* fromPromise */);

[Error: ENOENT: no such file or directory, open ‘/tmp/openfn/repo/node_modules/@openfn/language-dhis2_3.2.8/package.json’] {
errno: -2,
code: ‘ENOENT’,
syscall: ‘open’,
path: ‘/tmp/openfn/repo/node_modules/@openfn/language-dhis2_3.2.8/package.json’

Node.js v18.15.0

Hello @tsegayesemere! In your CLI command can you please try -ia dhis2 (where the i and a are together)? Currently you have the -i and -a separately like this: -i -a dhis2

Typically you want to use one or the other (e.g., -i dhis2 or -a dhis2)…
OR both together (e.g., -ia dhis2).
See here for the related OpenFn Docs page on the OpenFn CLI key usage commands.

If you’re still having issues, please paste the error in this thread and @mtuchi can respond tomorrow morning EAT :slight_smile:

1 Like

Hi @tsegayesemere, thanks for posting!

I’m a bit puzzled by the error - it seems to suggest the adaptor is installed, but then fails to find it.

Could you please:

  1. Add --log debug to your command and paste the output here (or email it to jclark at if it’s very long)

  2. Check whether a file exists at /tmp/openfn/repo/node_modules/@openfn/language-dhis2_3.2.8/package.json

It might also help to know which platform you’re running on.


1 Like

Great! Thanks @aleksa-krolls.
your solution worked.
It took more than 19 minutes to install the adaptor then finally it worked.

1 Like

glad you’re all sorted out @tsegayesemere , but wow… 19 minutes is a long time. they’re usually very quick, so I’d say if something is taking more than a few seconds it’s worth checking

while the adaptor itself is small the dependency installation might take a while if NPMjs is having trouble.

thanks so much for reporting :raised_hands: and please let us know if this problem pops back up again. use @jclark 's command (--log debug) so we can get a little more detail and let us know what OS and node version you’re using.

thanks again.

Installation time reduced significantly when I run it for a second time. Here is the log detail.
tsegay@tsegay-ThinkPad-L540:~/openfncodes$ openfn exportPatients.js -ia dhis2 -s dhis22.json -o test.json --no-strict-output --log debug
[CLI] :information_source: Versions:
▸ node.js 18.15.0
▸ cli 0.0.34
▸ runtime 0.0.21
▸ compiler 0.0.28
@openfn/language-dhis2 latest
[CLI] :information_source: Auto-installing language adaptors
[CLI] :heavy_check_mark: Installing packages…
[CLI] ❯ repoDir is set to: /tmp/openfn/repo
[CLI] :information_source: Looked up latest version of @openfn/language-dhis2: found 3.2.8
[CLI] ❯ Using latest installed version of @openfn/language-dhis2: 3.2.8
[CLI] :information_source: Skipping @openfn/language-dhis2@3.2.8 as already installed
[CLI] :heavy_check_mark: Installation complete in 1.437s
[CLI] ❯ Load state…
[CLI] :heavy_check_mark: Loaded state from dhis22.json
[CLI] ❯ state: {“configuration”:{“hostUrl”:““,“username”:””,“password”:“****”},“pdata”:[{“id”:1,“name”:“Leanne Graham”,“username”:“Bret”,“email”:“”,“address”:{“street”:“Kulas Light”,“suite”:“Apt. 556”,“city”:“Gwenborough”,“zipcode”:“92998-3874”,“geo”:{“lat”:“-37.3159”,“lng”:“81.1496”}},“phone”:“1-770-736-8031 x56442”,“website”:“”,“company”:{“name”:“Romaguera-Crona”,“catchPhrase”:“Multi-layered client-server neural-net”,“bs”:“harness real-time e-markets”}},