Open HeyITGuyFixIt opened 2 hours ago
From your output the call to edge-js
is not coming from the correct path, you need to exclude it from packaging and rebuilding.
There is a shortcut in node_modules called edge-js that points to "node_modules/.deno/edge-js@22.7.0/node_modules/edge-js". Not sure if that is what you are referring to.
Thats exactly what I am referring to, you will not have a very good time using edge-js
via shortcuts. edge-js
needs full node_modules deploy from where its called.
Doing a basic test with Node's REPL, and it imports edge-js without issue over the shortcut, and I could use it without issue. Not to say a more complex usage wouldn't run into an issue, but just that it shouldn't be the issue I am running into with Deno.
Deno could be trying to load it differently TypeError: LoadLibraryExW failed
is definitely a new one for edge-js
. One thing that comes to mind is possible architecture mismatch.
What can I do to try to figure out what library is failing to load?
No idea tbh.
When trying to install, after the error gets thrown, it says "Success: platform check for edge.js: node.js x64 v20.11.1". I guess Deno shows itself (in process.version
) as Node v20.11.1. I am running x64 Windows 11 PC.
Are you able to build a new experimental binary using tools/build.bat
, there is something you could try.
Clone edge-js
repo, cd
into tools and try running build release 20
in cmd. If you able to build new binaries I will provide some instruction that might help.
If not I will try to provide experimental binaries using GitHub Actions.
My version of node (22) doesn't match up with deno, so running build release 20
fails. I'll tinker with it and see if I can get a build.bat script working with deno. Maybe that will help this work. I could also try to downgrade my node to 20.11.1 and see if that allows it to create a compatible version for deno.
build release 20
is not dependant on your Node.js version, are you able to access artefacts on Build actions https://github.com/agracio/edge-js/actions/runs/10964800678? Scroll all the way to the bottom of the run.
Yes I can access them
Once this build is done https://github.com/agracio/edge-js/actions/runs/11039818774 grab the artefacts and replace binaries in \lib\native\win32\
in your Dino project. This issue https://github.com/denoland/deno/issues/23465 mentions win_delay_load_hook
setting.
Actually wait, need to run another build this has wrong settings. This build: https://github.com/agracio/edge-js/actions/runs/11040071911
I believe the issue is that edge-js is a node addon that uses Node.JS and V8's APIs directly (e.g. https://nodejs.org/api/addons.html#c-addons) which are not ABI stable and deno does not support.
The addon would have to use exclusively napi (https://nodejs.org/api/n-api.html), which is ABI stable, for deno to support it. This would have the added benefit of being guaranteed to work across Node major versions with a single addon, instead of having separate addons for each node major version.
The LoadLibraryExW
error occurs upon trying to load the addon because it has dependencies on dynamic libraries that are not present.
Well if that is the case then it does not look like edge-js
is compatible with Dino.
@agracio Would it even be possible to switch to using the ABI stable API? It would definitely help with supporting more than just Deno, but other versions of Node as well. Not sure how big of a rewrite that would be, if possible.
Very unlikely edge-js
has a very large C++ codebase that interfaces directly with V8 and nan
unless someone is willing to take on that work and rewrite everything.
To be honest it appears to be a niche issue that was never encountered before so the benefit would be very questionable.
There is also a big question of whether this is even possible.
I think it would great to have Deno supported in this project.
Deno is getting ready to release v2 very soon, which includes support for packages that use various install scripts. So testing with their rc and canary versions, I've been trying to get Edge.js working. When I install using
deno install --allow-scripts --node-modules-dir=auto npm:edge-js@^22.7.0
, it appears to successfully build, then Deno throws an error:I'm not sure if this is something that Deno needs to fix, or is something you guys can help fix, or if I'm missing something. But at the moment, it is not working with Deno. In case it is a Deno issue, I opened a ticket with them here.