agracio / edge-js

Run .NET and Node.js code in-process on Windows, macOS, and Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js v20 support

rvalimaki opened this issue · comments

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.

+1

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

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

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

Yes (:

@PranKe01 Thanks

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
  1. 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
  2. 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' ],

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

Thanks

@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

@Venryx thanks

Added support for Node v20.x, published

@agracio cool !