Node.js 22 Compat
Is it planned to support Node 22+?
On Node 23, there is a build error:
npm error ../../../nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)’:
npm error ../../../nan/nan.h:2548:8: error: ‘class v8::ObjectTemplate’ has no member named ‘SetAccessor’
npm error 2548 | tpl->SetAccessor(
It seems that this depends on https://github.com/nodejs/nan/pull/979
It seems to work in 23.6.0. I'll do more tests.
I just came across this very nice lib and I use it in an Electron app via nfc-pcsc.
Electron versions are coupled to Node versions, and Electron 34 with node 20 is just one month away from EOL. Newer Electron versions use Node 22, so Node 23 is not an option for me.
If anybody could update this lib for Node 22 or has an idea how to avoid the node-gyp errors when building pokusew/pcsclite this would be great.
This incompat re-surfaced on Node.js 24.1.0, though with a different error:
npm error ../src/pcsclite.cpp:112:26: required from here
npm error ../../../nan/nan_callbacks_12_inl.h:112:62: error: ‘const class v8::FunctionCallbackInfo<v8::Value>’ has no member named ‘Holder’
npm error 112 | inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
npm error | ~~~~~~^~~~~~
Seems like the NAN update is still in progress: https://github.com/nodejs/nan/pull/979
There already exists a fix, but it is not yet merged into nan. it's just info_.Holder(); has to be info_.This();. Hoewever, this cannot be patched using patch-package because the npm rebuild happens before patch-package can apply its patches.
But we can override the nan dependency in package.json to the fork that has the fix:
"overrides": {
"nan": "github:agracio/nan#a91d752"
},
This seems to work for me.
Edit: Related PRs:
- https://github.com/nodejs/nan/pull/979
- https://github.com/nodejs/nan/pull/1000
- https://github.com/nodejs/nan/pull/1001
@nikeee looks like our comments served a good purpose - nan v2.23.0