node-sane icon indicating copy to clipboard operation
node-sane copied to clipboard

Compile error on modern version Node

Open vit1251 opened this issue 3 years ago • 2 comments

Error message:

npm ERR! ../src/sane.cc:23:11: error: ‘Handle’ has not been declared in ‘v8’
npm ERR!    23 | using v8::Handle;
npm ERR!       |           ^~~~~~
npm ERR! ../src/sane.cc: In member function ‘virtual void GetDevicesWorker::HandleOKCallback()’:
npm ERR! ../src/sane.cc:58:51: error: no matching function for call to ‘v8::ObjectTemplate::NewInstance()’
npm ERR!    58 |         Local<Object> object = result->NewInstance();
npm ERR!       |                                ~~~~~~~~~~~~~~~~~~~^~
npm ERR! In file included from /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-function.h:15,
npm ERR!                  from /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8.h:33,
npm ERR!                  from /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/node.h:73,
npm ERR!                  from ../src/sane.cc:4:
npm ERR! /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-template.h:799:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::ObjectTemplate::NewInstance(v8::Local<v8::Context>)’
npm ERR!   799 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(Local<Context> context);
npm ERR!       |                                            ^~~~~~~~~~~
npm ERR! /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-template.h:799:44: note:   candidate expects 1 argument, 0 provided
npm ERR! ../src/sane.cc:59:20: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Int32>::return_t)’
npm ERR!    59 |         object->Set(Nan::New("status").ToLocalChecked(), Nan::New(status));
npm ERR!       |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-array-buffer.h:13,
npm ERR!                  from /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8.h:24:
npm ERR! /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-object.h:244:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
npm ERR!   244 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
npm ERR!       |                                     ^~~
npm ERR! /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-object.h:244:37: note:   candidate expects 3 arguments, 2 provided
npm ERR! /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-object.h:247:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
npm ERR!   247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
npm ERR!       |                                     ^~~
npm ERR! /home/vsedyshev/.cache/node-gyp/18.3.0/include/node/v8-object.h:247:37: note:   candidate expects 3 arguments, 2 provided
npm ERR! ../src/sane.cc:65:68: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
npm ERR!    65 |                 Local<Function> deviceFunc = deviceTpl->GetFunction();
...

Node version is

npm ERR! gyp ERR! node -v v18.3.0
npm ERR! gyp ERR! node-gyp -v v9.0.0

vit1251 avatar Jun 09 '22 14:06 vit1251

@vit1251 do you resolve this?

pratikpparikh avatar Apr 06 '23 14:04 pratikpparikh

@pratikpparikh I use example https://gist.github.com/StefanoBelli/fb65543553ce48dbd2744c513b3935e2 and make Node module with provide scan image.

vit1251 avatar Apr 11 '23 02:04 vit1251