We have a small app we have built on Theia - https://github.com/evolvedbinary/fusion-studio-extension. We recently updated the version of some depedencies. When we run cd electron-app && yarn run start
all is fine, but when we build our distributable app with electron-builder (based on yangster-electron example) - https://github.com/evolvedbinary/fusion-studio, on Windows/Mac after installing, the process starts and we can see it running in TaskMgr/ActivityMonitor but nothing happens on the screen - how can we start to debug that?
[original thread by Adam Retter]
@kittaakos @spoenemann Do you experience something like that?
What does it print to the console when you start the application from the terminal?
[Adam Retter]
@kittaakos Sorry for the delay, we had a conference to attend. So I just tried running it from cmd.exe
on Windows, and also from the Terminal on Mac, actually it shows absolutely nothing in there.
[Adam Retter]
@kittaakos However, I did just discover something on the Mac. If build it from source and then try and install from the DMG and try and run it from the terminal I get nothing and have to kill -9
the dead process. However, if I run the app in the dist/
sub-folder then it starts just fine. I attach two screenshots.
[Adam Retter]
Running from the installed DMG
[Adam Retter]
Running from the dist folder of the build
[Adam Retter]
The second screenshot seems to show more sub-processes. So at a guess some sub-processes are not starting correctly when running the Theia App when it is installed from a .dmg on Mac or .exe installer on Windows
[Adam Retter]
@anton-kosyakov @kittaakos @spoenemann Can anyone help me make any progress on this?
Akos is away this week. Unfortunately, I’m not involved in distributing any electron versions and cannot help. Maybe @thegecko can help?
[Rob Moran]
I’ve not seen this problem, but the dist folder seems odd as your output code is going into lib AFAICT
also from the Terminal on Mac, actually it shows absolutely nothing in there.
It prints this error:
Akoss-MacBook-Pro:fusion-studio akos.kitta$ /Applications/Fusion\ Studio.app/Contents/MacOS/Fusion\ Studio
Failed to start the backend application.
{ Error: Cannot find module 'fs-extra'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
at Function.Module._load (internal/modules/cjs/loader.js:528:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Applications/Fusion Studio.app/Contents/Resources/app/node_modules/@theia/filesystem/lib/node/node-filesystem.js:94:10)
at Object.<anonymous> (/Applications/Fusion Studio.app/Contents/Resources/app/node_modules/@theia/filesystem/lib/node/node-filesystem.js:926:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12) code: 'MODULE_NOT_FOUND' }
/Applications/Fusion Studio.app/Contents/Resources/app/node_modules/@theia/core/lib/node/main.js:56
throw reason;
^
Error: Cannot find module 'fs-extra'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
at Function.Module._load (internal/modules/cjs/loader.js:528:25)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Applications/Fusion Studio.app/Contents/Resources/app/node_modules/@theia/filesystem/lib/node/node-filesystem.js:94:10)
at Object.<anonymous> (/Applications/Fusion Studio.app/Contents/Resources/app/node_modules/@theia/filesystem/lib/node/node-filesystem.js:926:3)
at Module._compile (internal/modules/cjs/loader.js:711:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
I have checked the final application and fs-extra
was indeed missing. Perhaps this is an electron-builder
issue. As a quick workaround, you can do
diff --git a/package.json b/package.json
index a1d0231..6fc2869 100644
--- a/package.json
+++ b/package.json
@@ -49,6 +49,7 @@
"@theia/electron": "latest",
"@theia/textmate-grammars": "latest",
"fusion-studio-extension": "latest",
+ "fs-extra": "^4.0.3",
"xterm": "^4.0.0",
"yargs": "^14.0.0"
},
run yarn && yarn build && yarn package
install the final application, and it works.
However, if I run the app in the dist/ sub-folder then it starts just fine
Note, this does not matter. It is just a coincident; it picks up the dependencies from your node_modules
folder. It won’t work in production mode.
[Adam Retter]
@kittaakos Ah ha thank you so much. On Mac I was running: open /Applications/Fusion\ Studio.app
which didn’t show the errors. As you said, instead running: /Applications/Fusion\ Studio.app/Contents/MacOS/Fusion\ Studio
does show the errors.
[Adam Retter]
@kittaakos Is there a way to find out where the missing dependency on fs-extra
has been introduced from?
[Adam Retter]
Does the stacktrace above infer that it is missing as a dependency of @theia/filesystem
?
It seems to be a hoisting issue. fs-extra@8.1.0
is hoisted to the top node_modules
folder. And if you check @theia/core
’s dependencies, you can see, it still requires fs-extra@^4.0.2
. The expected version (4.0.2.
) of fs-extra
got stuck in node_modules/@theia/core/node_modules/fs-extra
folder.
[Adam Retter]
@kittaakos I am afraid I am not much of a Node/JavaScript person. What should I do to fix the root cause of the issue?