Deno Oak doesnt work when compiled to `.exe`
Hi 👋
I have this example from Deno site and when compile it to
.exe
and run it, I get the longs in the console of the .exe
.
I have something similar with Oak:
The problem is that I don't get the longs in the console of the .exe
when I run it. I don't get any errors, it's just a blank terminal.
Does Oak does something behind the seen that breaks this? I can't use other frameworks if they don't have the same issue.7 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the code snippet you provided, I noticed a couple of potential issues that might be causing problems when you compile your Deno Oak application to an
.exe
file.
1. In the Oak example, you are using Deno.readTextFileSync("./src/pages/index.html")
. When you compile your application to an .exe
, the file paths might not resolve correctly. Make sure that the path to index.html
is correct and that the file is included in the compiled executable.
2. The catch
block in your Oak router's POST handler uses next()
without await
. This should be await next()
. However, this is unlikely to be the cause of the issue you're experiencing with the logs not appearing.
3. The await APP.listen({ port: PORT })
line starts the server. If there's an issue with the server starting up, you might not see any logs. Ensure that the port is not already in use and that your application has the necessary permissions to bind to that port.
Please note that these suggestions are not based on the Deno documentation, and I advise you to double-check the accuracy of the advice given. If the issue persists, you may want to look into how the compilation process packages your application and whether all dependencies and resources are correctly included.As bot said in item 1, it might be because Oak is trying to load something from the filesystem using a relative path
I fixed those up. I was going to send more info on this but Discord didn't allow me to send a screenshot.
Even this code doesn't work (no console log and no errors):
Can someone check this out if they have the same issue on their system?
GitHub
Error: Cannot find module '../lightningcss.win32-x64-msvc.node' · p...
Hi 👋 This error only happens when I compile my Deno project to a .exe file. In development, everything works fine. I don't know what is the deal with lightningcss.win32-x64-msvc.node. import { ...
I tried your example and some Oak code with a route and error handler. Neither runs correctly when compiled.
Tried Deno 1.41.3 and 1.42.1 on Linux Devuan 5.10.0-28-amd64 #1 SMP Debian 5.10.209-2 (2024-01-31) x86_64 GNU/Linux
Tried deno compile -r to reload the cache.
When you run the compiled binaries under strace they are looking for files in the .cache directory of the user's home directory which seems odd. Other compiled Deno code doesn't do that. Then the binary is just hung on a epoll_wait() call.
Hey 👋
Thank you for taking the time and taking a look into this!
I removed Oak and switched to https://deno.land/x/abc@v1.3.3, it doesn't have the same issue and has a much cleaner API.
Thanks again.
Thats a weird bug
when compiled it get stuck at the import