Problem with @theia/git extension

Hi,

I have a problem, when adding the @theia/git extension to my project.

My setup with following @theia extensions works fine:


@theia/core”: “next”,
@theia/filesystem”: “next”,
@theia/workspace”: “next”,
@theia/preferences”: “next”,
@theia/navigator”: “next”,
@theia/process”: “next”,
@theia/terminal”: “next”,
@theia/editor”: “next”,
@theia/languages”: “next”,
@theia/markers”: “next”,
@theia/monaco”: “next”,
@theia/messages”: “next”,
@theia/electron”: “next”

But as soon as I add @theia/git to it, I run into following runtime issue:

bundle.js:131054 Error: Cannot apply @injectable decorator multiple times.

I have the same impact for browser and electron variant.

I have even removed my own extensions, to check if it is caused by them, which is not.

Any idea, what this could be ?

Thanks

[original thread by surrender70]

@brokenframe the error is caused whenever there is a version mismatch between @theia extensions, for instance if you are using a combination of both latest and next. When using next there may be a small chance that an extension has not been successfully published to npm (and should resolve at some point) and will cause the mismatch issue to happen. If you were to verify node_modules for @theia/git you could see the specific @theia/git version you’re pulling and seeing if there is a mismatch with your other theia extensions.

@brokenframe can you share you complete package.json? It sounds strange that just adding @theia/git would break your app.

“next” versions are published every time a commit is merged in our repo. This means this happens relatively often. If you build you “next”-based app often enough, you are bound for it to happen in the middle of such a publish, with only a subset of the needed extension published. This may be what you encountered if it just started working again on its own a little while later

[surrender70]

Hi Marc,

[surrender70]

this is the link to our package.json: https://gitlab.com/systemticks/slogr/-/blob/master/code/app/electron/package.json

Please run yarn why @theia/core in your monorepo to see why you have different versions and then eliminate bogus depedencies

@brokenframe I was curious so I had a look at your repo and built your app. I think I found your issue: you should never mix Theia “latest” and “next” versions of packages. You have an instance of this in your @slogr/lql-client. Just put “next” there too: https://gitlab.com/systemticks/slogr/-/blob/master/code/app/extensions/lql-client/package.json#L19

But that’s without @theia/git. When I add it, indeed, I see 2 different “next” versions (one 1.1.0-next and another 1.2.0-next) for some/many extensions.

I do not know how to start the app, but likely as you report it would not start in this state.

@brokenframe I think then you just need to update this yarn.lock - it’s pinning the version of the Theia extensions already present in the repo to that 1.1.0-next version, but any new extension you add will not be subject to the pinning and will bring trouble for your app. I deleted it and after rebuild, one single version of @theia/core is pulled.

[surrender70]

@marc-dumais

[surrender70]

Thank you for all the hints and directions.
I have it up and running now, for both browser and electron.

But what has beed weird first:

When started electron-app for the first time I got following error: Cannot find module ‘lodash.isinteger’.

The exception had it roots in nsfw.
I looked into my node_modules folder and I saw that nsfw was installed with version 1.2.7, which indeed has a dependency to lodash.isinteger.
But lodash.isinteger was not installed at all.

When I did rebuild:browser I could see that nsfw has then been updated to version 1.2.9, which has no longer a dependency to lodash.integer.
That is why the browser-app was runnning.

When again doing rebuild:electron it apparently forced the installation back to 1.2.7.

I then removed again the yarn.lock and node_modules and all other generated artifacts and built again.
Then it worked.

Thanks again.