robot-js icon indicating copy to clipboard operation
robot-js copied to clipboard

Incompatible with node v10 (NODE_MODULE_VERSION=64)

Open p120ph37 opened this issue 5 years ago • 10 comments

The API for Node 10 has changed, and the existing robot-js bindings do not compile against it correctly. Testing with Node v10.6.0 on Linux, I get this set of errors:

In file included from ../src/NodeImage.h:15:0,
                 from ../src/NodeImage.cc:14:
../src/NodeImage.cc: In static member function ‘static void ImageWrap::GetPixel(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/NodeCommon.h:68:47: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [4])’
    (isolate, JsColor)->NewInstance (4, _jsArgs) \
                                               ^
../src/NodeCommon.h:112:54: note: in definition of macro ‘RETURN’
 #define RETURN( value ) { args.GetReturnValue().Set (value); return; }
                                                      ^
../src/NodeCommon.h:125:10: note: in expansion of macro ‘NEW_COLOR’
  RETURN (NEW_COLOR (r, g, b, a));
          ^
../src/NodeImage.cc:112:2: note: in expansion of macro ‘RETURN_COLOR’
  RETURN_COLOR (color.R, color.G,
  ^
../src/NodeCommon.h:68:47: note: candidates are:
    (isolate, JsColor)->NewInstance (4, _jsArgs) \
                                               ^
../src/NodeCommon.h:112:54: note: in definition of macro ‘RETURN’
 #define RETURN( value ) { args.GetReturnValue().Set (value); return; }
                                                      ^
../src/NodeCommon.h:125:10: note: in expansion of macro ‘NEW_COLOR’
  RETURN (NEW_COLOR (r, g, b, a));
          ^
../src/NodeImage.cc:112:2: note: in expansion of macro ‘RETURN_COLOR’
  RETURN_COLOR (color.R, color.G,
  ^
In file included from /home/travis/.node-gyp/10.6.0/include/node/node.h:63:0,
                 from /home/travis/.node-gyp/10.6.0/include/node/node_buffer.h:25,
                 from ../src/NodeCommon.h:16,
                 from ../src/NodeImage.h:15,
                 from ../src/NodeImage.cc:14:
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3911:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3911:44: note:   candidate expects 3 arguments, 2 provided
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3914:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3914:44: note:   candidate expects 1 argument, 2 provided
../src/NodeImage.cc: In static member function ‘static void ImageWrap::New(const v8::FunctionCallbackInfo<v8::Value>&)’:
../src/NodeImage.cc:206:37: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [4])’
       _jsArgs[1] = args[1], _jsArgs));
                                     ^
../src/NodeImage.cc:206:37: note: candidates are:
In file included from /home/travis/.node-gyp/10.6.0/include/node/node.h:63:0,
                 from /home/travis/.node-gyp/10.6.0/include/node/node_buffer.h:25,
                 from ../src/NodeCommon.h:16,
                 from ../src/NodeImage.h:15,
                 from ../src/NodeImage.cc:14:
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3911:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3911:44: note:   candidate expects 3 arguments, 2 provided
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3914:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3914:44: note:   candidate expects 1 argument, 2 provided
In file included from ../src/NodeImage.h:15:0,
                 from ../src/NodeImage.cc:14:
../src/NodeImage.cc:223:35: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [4])’
     _jsArgs[1] = args[1], _jsArgs)));
                                   ^
../src/NodeCommon.h:112:54: note: in definition of macro ‘RETURN’
 #define RETURN( value ) { args.GetReturnValue().Set (value); return; }
                                                      ^
../src/NodeImage.cc:223:35: note: candidates are:
     _jsArgs[1] = args[1], _jsArgs)));
                                   ^
../src/NodeCommon.h:112:54: note: in definition of macro ‘RETURN’
 #define RETURN( value ) { args.GetReturnValue().Set (value); return; }
                                                      ^
In file included from /home/travis/.node-gyp/10.6.0/include/node/node.h:63:0,
                 from /home/travis/.node-gyp/10.6.0/include/node/node_buffer.h:25,
                 from ../src/NodeCommon.h:16,
                 from ../src/NodeImage.h:15,
                 from ../src/NodeImage.cc:14:
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3911:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3911:44: note:   candidate expects 3 arguments, 2 provided
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3914:44: note: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^
/home/travis/.node-gyp/10.6.0/include/node/v8.h:3914:44: note:   candidate expects 1 argument, 2 provided

In the long-term, I'm sure we will want to rework this module to use NAN or N-API, but in the short-term, I wonder if there is a way to adjust the macros so as to support ABI 64...

p120ph37 avatar Jul 25 '18 21:07 p120ph37

Other projects have seen the same issue (and provide clues for fixing it): https://github.com/phusion/node-sha3/pull/33 https://github.com/Wulf/nodehun/issues/63

Explanation of issue on SO: https://stackoverflow.com/questions/45388032/how-to-silence-newinstance-is-deprecated-warning-in-node-gyp-rebuild-what

p120ph37 avatar Jul 25 '18 21:07 p120ph37

Thanks for this, I'll take a look!

dkrutsko avatar Jul 25 '18 23:07 dkrutsko

I may actually have a fix ready for you already - I'll open a PR as soon as I've run it through CI to be sure it still compiles on ancient Node versions...

p120ph37 avatar Jul 25 '18 23:07 p120ph37

Sounds good, thanks.

dkrutsko avatar Jul 25 '18 23:07 dkrutsko

Okay - looks clean all the way back to Node v0.12, so I'll open the PR now.

p120ph37 avatar Jul 25 '18 23:07 p120ph37

Looks great, I'll prep for a new release today.

dkrutsko avatar Jul 25 '18 23:07 dkrutsko

I'm also working on updating my node-gyp-pre fork to the latest. I happen to be looking at all of this right now because I needed support for Chrome >=66, by way of Electron 3.0.0, which uses Node 10 headers, so I figured I'd just update the whole upstream chain while I was fixing things.

p120ph37 avatar Jul 25 '18 23:07 p120ph37

Is this going to be released? Thanks :)

srolel avatar Aug 28 '18 17:08 srolel

Is there any update on upcoming releases?

s1hofmann avatar Jan 29 '19 09:01 s1hofmann

@s1hofmann The fix it's merged in the Dev Branch. You can install the lib from GitHub using this command:

npm install --save Robot/robot-js#dev

catrielmuller avatar Feb 22 '19 19:02 catrielmuller