openupm/openupm-cli

adding package causes an exception TypeError when an resolve is error occurs

Closed this issue · 4 comments

Running openupm add com.annulusgames.lit-motion results in exceptions in the CLI.

Exception:

C:\Users\User\AppData\Roaming\npm\node_modules\openupm-cli\lib\services\dependency-resolving.js:74
                    if (resolveResult.error instanceof npm_registry_fetch_1.HttpErrorBase)
                                            ^

TypeError: Right-hand side of 'instanceof' is not an object
    at C:\Users\User\AppData\Roaming\npm\node_modules\openupm-cli\lib\services\dependency-resolving.js:74:45
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async tryAddToManifest (C:\Users\User\AppData\Roaming\npm\node_modules\openupm-cli\lib\cli\cmd-add.js:105:43)
    at async C:\Users\User\AppData\Roaming\npm\node_modules\openupm-cli\lib\cli\cmd-add.js:184:28
    at async Command.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\openupm-cli\lib\cli\index.js:84:23)

Node.js v20.12.2

The -f option does not help to avoid this error

Manually adding a package does not cause problems.

Dependencies of this package:

"com.unity.burst": "1.6.0",
"com.unity.collections": "1.5.1",
"com.unity.mathematics": "1.0.0"

Thanks for letting us now. I'll look into this now.

This problem is because of a bad declaration file for an external module. The resulting js file did not correctly import the HttpErrorBase class.

Should be fixed in 2.0.1. Could you confirm @ArkTarusov?

Note that your package can still not be added because of some dependency-issue. The CLI output for this is not great, definitely something to improve.

@ComradeVanti thanks for this fix!
Now the error is readable.