Shouqun / node-dbus

dbus module for node
MIT License
150 stars 70 forks source link

Node 18 incompatible with outdated version of nan #241

Open cywang117 opened 1 year ago

cywang117 commented 1 year ago

Attempting npm i with Node 18 fails with:

node_modules/nan/nan_typedarray_contents.h:34:43: error: ‘class v8::ArrayBuffer’ has no member named ‘GetContents’
...
make: *** [dbus.target.mk:134: Release/obj.target/dbus/src/dbus.o] Error 1
make: Leaving directory '/home/christina/github/node-dbus/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/christina/github/node-dbus/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.19.0-76051900-generic
gyp ERR! command "/home/christina/.nvm/versions/node/v18.10.0/bin/node" "/home/christina/github/node-dbus/node_modules/.bin/node-gyp" "configure" "build"
gyp ERR! cwd /home/christina/github/node-dbus
gyp ERR! node -v v18.10.0
gyp ERR! node-gyp -v v4.0.0
gyp ERR! not ok 
npm ERR! code 1
npm ERR! path /home/christina/github/node-dbus
npm ERR! command failed
npm ERR! command sh -c -- npm run build:release

Whereas npm i with Node 16 succeeded without issue. The source of the issue is that GetContents was replaced with GetBackingStore in 2019. After upgrading nan with npm i nan@latest (2.17.0 at time of issue creation), npm i with Node 18 succeeded. Can nan be bumped to latest? Looking at the commit in nan where GetBackingStore was introduced, there shouldn't be any backwards compatibility issues.

EDIT: I tried to make a PR but this repo doesn't seem to allow outside contributors?

cywang117 commented 1 year ago

@Shouqun Any input?