Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ArkTarusov opened this issue Apr 30, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ArkTarusov
Copy link

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"
@ComradeVanti ComradeVanti self-assigned this May 2, 2024
@ComradeVanti
Copy link
Collaborator

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

@ComradeVanti ComradeVanti added the bug Something isn't working label May 2, 2024
@ComradeVanti
Copy link
Collaborator

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

ComradeVanti added a commit that referenced this issue May 2, 2024
The declaration files for `npm-registry-fetch` package do not expose the error-class it throws when a fetch failed. Because of this, we wrote our own declaration file for it.

The declaration file was incorrectly written. It placed the error class into the packages `index` file even though it is inside `lib/errors`. After updating the declaration and relevant imports the error is now fixed.

See #319.
ComradeVanti added a commit that referenced this issue May 2, 2024
The declaration files for `npm-registry-fetch` package do not expose the error-class it throws when a fetch failed. Because of this, we wrote our own declaration file for it.

The declaration file was incorrectly written. It placed the error class into the packages `index` file even though it is inside `lib/errors`. After updating the declaration and relevant imports the error is now fixed.

See #319.
github-actions bot pushed a commit that referenced this issue May 2, 2024
## [2.0.1](2.0.0...2.0.1) (2024-05-02)

### Bug Fixes

* bad declaration file ([#320](#320)) ([3d6d888](3d6d888)), closes [#319](#319)
@ComradeVanti
Copy link
Collaborator

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.

@ArkTarusov
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants