I have been working on a custom extension for Theia that was deploying sucessfully, but, suddenly, i got this error on browser console:
And i haven’t been able to deploy my extension again. This is my package.json for the extension:
This is my package.json for the browser-app:
And these are the imports used in my custom extension:
Things that i have tried
-
Delete the node modules folder of both the extension and browser-app, and reinstalling using yarn.
-
Install missing dependencies in the extension folder AND in the browser-app folde using yarn add .
-
Erase all files and reimplement the extension from scratch, only editing the extension package.json and the code of the extension itself.
-
Rebuild constantly using lerna with yarn prepare and yarn rebuild:browser.
-
Watching code using yarn watch on both the extension folder and the browser-app folder (sometimes yarn cannot unbind libraries when trying to compile using yarn prepare on root folder and i am forced to restart my machine to build succesfully).
-
Search on StackOverflow for similar errors without luck.
Things that i want to achieve
-
Run a process just after Theia’s start.
-
Recieve confirmation that the process is running as it should (from stdout or something like that).
-
Deploy a mini-browser previewing a localhost address where the process is exposed.
-
Make a http request from the extension.
Things that the extension was doing before the issue
-
Done successfully
-
On process.
-
Done successfully.
-
Not able to.
The last two sections were put because they could help to understand the problem.
Thank you for your help!.
[original thread by loladmebrah]
try to remove express from dependencies
@theia/core alredy brings the proper version, if you declare your own i’m not sure what can happen
if it does not help, could you make a reproducible repo?
[loladmebrah]
@anton-kosyakov Thank you for your fast response, i did as you instructed. I regenerated the proyect using the yeoman generator for theia’s extensions, and used the following dependency list:
“dependencies”: {
“@theia/callhierarchy”: “latest”,
“@theia/console”: “latest”,
“@theia/core”: “latest”,
“@theia/debug”: “latest”,
“@theia/debug-nodejs”: “latest”,
“@theia/editor”: “latest”,
“@theia/file-search”: “latest”,
“@theia/git”: “latest”,
“@theia/json”: “latest”,
“@theia/markers”: “latest”,
“@theia/merge-conflicts”: “latest”,
“@theia/messages”: “latest”,
“@theia/mini-browser”: “latest”,
“@theia/navigator”: “latest”,
“@theia/outline-view”: “latest”,
“@theia/preferences”: “latest”,
“@theia/preview”: “latest”,
“@theia/process”: “latest”,
“@theia/search-in-workspace”: “latest”,
“@theia/terminal”: “latest”,
“@theia/textmate-grammars”: “latest”,
“@theia/typescript”: “latest”
},
“devDependencies”: {
“rimraf”: “latest”,
“typescript”: “latest”
},
[loladmebrah]
After that i compiled the extension without problem, and then, after i updated the aforementioned extension with my code and proceeded to compile it, i got this problem:
[loladmebrah]
So, in my ingenuity i decided to install ‘tls’ from yarn, and after the instalation and succesfull compilation i got this message again:
[loladmebrah]
What i can get of this is:
-
Yarn succesfully installs all dependencies from Theia.
-
Something in my code breaks the compilation in yarn, and makes it ask for tls.
-
Manually installing tls breaks the way webpack solves it’s dependency management internally.
[loladmebrah]
This is the code i have been trying to compile, maybe you can see what i am not able to.
[loladmebrah]
@anton-kosyakov, I’m so sorry! i was in a rush so i didn’t read completely, here is the public repo: https://github.com/loladmebrah/theia-extension-test/
[loladmebrah]
Found the issue, when i comment the following line:
import { TerminalProcessFactory, TerminalProcess, ProcessManager } from ‘@theia/process/lib/node’
and remove the respective injections, the proyect can compile and deploy normally, i don’t really know if i did a mistake calling the library.
But there it is. What can i do to correctly use the process library?
From what I can tell you cannot import backend code node
from the frontend browser
.
Here I can see a mix of browser and node imports which is not possible
Such general guidelines can be viewed in our code organization.