Theia: Different versions of @theia/core are causing 'Cannot apply @injectable decorator multiple times' error

Created on 1 Mar 2020  路  7Comments  路  Source: eclipse-theia/theia

Description

I have created a sample Theia extension using 'yo theia-extension'.
When trying to start the server I get the error: 'Failed to start the frontend application',
where the root cause is: 'Error: Cannot apply @injectable decorator multiple times.',
reffering to @theia/core.

I checked @theia/core dependency and saw that some extensions require @theia/core version 0.15.0 and some 0.16.0,
for example, /node_modules/@theia/monaco/node_modules/@theia/core

Could this be causing the error?

I saw that a new release of @theia/core was out two days ago, which more or less matches the time this problem started for me.

Reproduction Steps

yo theia-extension
and start theia.

OS and Theia version:
Ubuntu 18.04.4

Diagnostics:
N/A

dependencies question

Most helpful comment

My versions are all "latest" in the package.json.

@loblab the issue occurs due to the fact that there are deprecated extensions included with the generator (https://github.com/eclipse-theia/theia/pull/6933 fixes the issue but has not been released as of yet). Since these extensions have been removed prior to v0.16.0 (latest), if you include them in your application they will actually be at 0.15.0 and thus pull different versions of core.

For the moment (until the release of the updated generator), you can remove any extension as described in the following pull-request (https://github.com/eclipse-theia/theia/pull/6933). For the generator this consists of:

  • @theia/textmate-grammars
  • @theia/typescript

All 7 comments

@tsiyona thank you for the issue!

It is not possible to mix and match versions of an extension (two extensions cannot both use @theia/core at different versions or the following failure will occur. For the generator-theia-extension there is a fix ready (https://github.com/theia-ide/generator-theia-extension/pull/53) but it has yet to be approved and merged. In the meantime, you can update your package.json manually to remove deprecated extensions which are causing the problem.

Additional Information:

oh, we should have merged it before the release 馃檲 sorry I have not seen the PR

I did change the versions to "latest" manually before I opened the issue. I will wait for your fix. Thank you :)

Same issue here, running the sample generated by "yo theia-extension", following the doc, for Electron, on Windows.
My versions are all "latest" in the package.json.
Where can I modify the different versions of @theia/core? Thanks.

image

My versions are all "latest" in the package.json.

@loblab the issue occurs due to the fact that there are deprecated extensions included with the generator (https://github.com/eclipse-theia/theia/pull/6933 fixes the issue but has not been released as of yet). Since these extensions have been removed prior to v0.16.0 (latest), if you include them in your application they will actually be at 0.15.0 and thus pull different versions of core.

For the moment (until the release of the updated generator), you can remove any extension as described in the following pull-request (https://github.com/eclipse-theia/theia/pull/6933). For the generator this consists of:

  • @theia/textmate-grammars
  • @theia/typescript

@vince-fugnitto Thanks. It works.

@vince-fugnitto Thanks. It works.

The generator has been updated to remove deprecated extensions causing the issue:
https://github.com/theia-ide/generator-theia-extension/commit/3594d1fa8dcd9ab76ccfcb902d97a64c0ef0b6bb

Was this page helpful?
0 / 5 - 0 ratings