agracio / edge-js

Run .NET and Node.js code in-process on Windows, macOS, and Linux
MIT License
618 stars 93 forks source link

Node.js v20 support #181

Closed rvalimaki closed 5 months ago

rvalimaki commented 1 year ago

Node version 20 isn't supported yet. I was able to compile edge-js on x64 Windows 10 & node.js v 20.2.0. Also I did ran through all the mocha tests, 73 passing, only 1 failing:

73 passing (9s) 1 failing

1) .net returns Func to node.js [.NET] releases the func: AssertionError [ERR_ASSERTION]: This test must be run with --expose-gc set at Context. (test\103_net2node.js:260:10) at process.processImmediate (node:internal/timers:478:21)

Also I can run the edge-js without problems, altough all I do is just call one .NET call and get the result alright.

PranKe01 commented 11 months ago

+1

Please update the versionMap variable in edge.js file, to support node v20 (and v21 in end of october).

x4080 commented 10 months ago

@PranKe01 just changing the verionMap variable will make it work for node v20 and even v21 ?

PranKe01 commented 10 months ago

@PranKe01 just changing the verionMap variable will make it work for node v20 and even v21 ?

Yes (:

x4080 commented 10 months ago

@PranKe01 Thanks

Venryx commented 9 months ago

I'm on Node 20.5.0, and hitting an issue.

I've tried editing versionMap variable, like so:

var versionMap = [
    [ /^14\./, '14.19.3' ],
    [ /^16\./, '16.15.1' ],
    [ /^18\./, '18.4.0' ],
    [ /^19\./, '19.3.0' ],
    [ /^20\./, '19.3.0' ],      // <-- I added this line
];

However, when trying to run, I get this error:

Signal: uncaughtException Error: Error: Module did not self-register: '\\?\C:\PATH_TO_MY_PROJECT\node_modules\edge-js\lib\native\win32\x64\19.3.0\edge_nativeclr.node'.

Any tips?

EDIT: Nevermind, the problem is I'm trying to just hot-patch the npm-installed version of "edge-js", whereas it appears I have to recompile it for my specific node version manually.

EDIT2: After rebuilding the files, it worked just fine. :)

Steps: (based on: https://github.com/agracio/edge-js#building-on-windows) 1) Clone latest version of edge-js repo. 2) Run:

npm install
npm install -g node-gyp
node-gyp configure --msvs_version=2015
node-gyp build -debug

3) Copy the two built ".node" files (from ./build/Debug) to the right location for use by your project: C:\PATH_TO_YOUR_PROJECT\node_modules\edge-js\lib\native\win32\x64\LATEST_EDGEJS_VERSION 4) Modify the ./node_modules/edge-js/lib/edge.js file (within your project) to know that it works on node v20, by adding this line to the versionMap var:

[ /^20\./, 'LATEST_EDGEJS_VERSION' ],
x4080 commented 9 months ago

@Venryx Could you share the node-gyp build files ?

Thanks

Venryx commented 9 months ago

@Venryx Could you share the node-gyp build files ?

Thanks

Do you mean the resulting ".node" files? If so, I've just uploaded them here: https://github.com/Venryx/edge-js/releases/tag/v20.5.0-win-debug

x4080 commented 9 months ago

@Venryx thanks

agracio commented 8 months ago

Added support for Node v20.x, published

x4080 commented 8 months ago

@agracio cool !