Open SammyLee40 opened 1 day ago
You don't want to be on Windows when debugging things like these. If you swap to Linux (or even just WSL2) you have tons more and better tools to see what is wrong.
But at the same time - never heard of SEA and I know there are many bundlers that don't work with uWS. They often neglect native addons.
Btw, nobody is going to run an .exe attached to your post. I removed it. Please do not attach .exe files here.
Hi,
I was recently trying out UWS and loved the performance gains, but wanted to make sure it worked with .exe. (https://nodejs.org/api/single-executable-applications.html#single-executable-applications)
First, I tried using it with npx webpack. Works great!
Then, I tried using it by injecting the blob into my executable. This works for other .node files perfectly, but with the same uws_win32_x64_120.node we used for our bundle.js that worked- we see it crash our exe with no error.
I've managed to strip away everything and get it down to the one function causing the error, so other than require() or createRequire(), the real problem is dlopen(). For whatever reason, even with the same system, seconds after running the working dlopen on a bundled JS file, the same method fails when run inside an executable. I've debugged to making sure the node file exists and is found properly, but can't go much further without C code, as NodeJS exe refuses to catch the error, crashing instead, making me think some kind of segfault or otherwise is happening on UWS's side.
I've created a working minimal example below.
To run it, just do:
node server.js
which should work and show:
node server.js
Then you can do
npx webpack
andnode bundle.js
and see the same output, indicating packing works fine. However, if we compiled the executable by doing:node -e "require('fs').copyFileSync(process.execPath, 'test.exe')"
npm run sea
npm run postject
then running
test.exe
shows:Just crashing, despite our try/catch, indicating the dlopen or C code is faulting.
Attached are the files you need to reproduce this.
<removed for security reasons>