Node-gyp: can not use the node-gyp to compile the c++ in node version 11.10.0

Created on 25 Feb 2019  Â·  5Comments  Â·  Source: nodejs/node-gyp

  • Node Version: 11.10.0
    npm Version:6.7.0
  • Platform: window10
  • Module:

I want to use the node-ffi module, I have done this in node version 8.11.2, but when I switch my node version to 11.10.0, I have meet problem? then, I have write a hello.cc and binding.gyp file, when I use the node version 8.11.2, It can compile success, but node version 11.10.0, It meeting the same error, the error following:
C:\Users\chengdong.node-gyp\11.10.0\x64\node.lib : fatal error LNK1127: ćș“ć·ČæŸć [E:\electron_project\c++\testnodegyp\build\addon.vcxp
roj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe failed with exit
code: 1
gyp ERR! stack at ChildProcess.onExit (E:\nvm\v11.10.0\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "E:\node\node.exe" "E:\node\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd E:\electron_project\c++\testnodegyp
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Thanks !

Most helpful comment

@Lukcyluke Actually the "unnecessary console log" contains the actual error:

../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/RCSwitchNode.cpp:83:59: error: no matching function for call to ‘v8::Function::NewInstance(const int&, v8::Local<v8::Value> [0])’
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:

This error indicates that the module you are installing (rcswitch) hasn't been updated for newer versions of Node.js (see also https://github.com/marvinroger/node-rcswitch/issues/15).

All 5 comments

You should report this in node-ffi issue tracker

  • Node Version: 11.10.0 and npm Version: 6.7.0
  • Platform: DietPi v6.21.1
  • Module: rcswitch

I actually have the same issue with an other package (see end of console log down below). The issue seems to lie in the compatibility of node-gyp and node. But I'm not sure about that.


unnecessary console log

root@DietPi:~# npm install rcswitch

> [email protected] install /root/node_modules/rcswitch
> node-gyp rebuild

make: Entering directory '/root/node_modules/rcswitch/build'
  CXX(target) Release/obj.target/rcswitch/src/rcswitch.o
  CXX(target) Release/obj.target/rcswitch/src/RCSwitchNode.o
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::SwitchOp(const Nan::FunctionCallbackInfo<v8::Value>&, bool)’:
../src/RCSwitchNode.cpp:46:35: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       switchOp2(group->Int32Value(), swtch->Int32Value());
                                   ^
../src/RCSwitchNode.h:19:69: note: in definition of macro ‘switchOp2’
   #define switchOp2(p1, p2) { if(switchOn) thiz->rcswitch.switchOn((p1), (p2)); else thiz->rcswitch.switchOff((p1), (p2)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:46:56: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       switchOp2(group->Int32Value(), swtch->Int32Value());
                                                        ^
../src/RCSwitchNode.h:19:75: note: in definition of macro ‘switchOp2’
 ine switchOp2(p1, p2) { if(switchOn) thiz->rcswitch.switchOn((p1), (p2)); else thiz->rcswitch.switchOff((p1), (p2)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:46:35: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       switchOp2(group->Int32Value(), swtch->Int32Value());
                                   ^
../src/RCSwitchNode.h:19:112: note: in definition of macro ‘switchOp2’
 thiz->rcswitch.switchOn((p1), (p2)); else thiz->rcswitch.switchOff((p1), (p2)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:46:56: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       switchOp2(group->Int32Value(), swtch->Int32Value());
                                                        ^
../src/RCSwitchNode.h:19:118: note: in definition of macro ‘switchOp2’
 iz->rcswitch.switchOn((p1), (p2)); else thiz->rcswitch.switchOff((p1), (p2)); }
                                                                         ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:52:46: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         switchOp2(*sGroup, swtch->Int32Value());
                                              ^
../src/RCSwitchNode.h:19:75: note: in definition of macro ‘switchOp2’
 ine switchOp2(p1, p2) { if(switchOn) thiz->rcswitch.switchOn((p1), (p2)); else thiz->rcswitch.switchOff((p1), (p2)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:52:46: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         switchOp2(*sGroup, swtch->Int32Value());
                                              ^
../src/RCSwitchNode.h:19:118: note: in definition of macro ‘switchOp2’
 iz->rcswitch.switchOn((p1), (p2)); else thiz->rcswitch.switchOff((p1), (p2)); }
                                                                         ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:65:48: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         switchOp3(*(*v8str), group->Int32Value(), devce->Int32Value());
                                                ^
../src/RCSwitchNode.h:20:79: note: in definition of macro ‘switchOp3’
 switchOp3(p1, p2, p3) { if(switchOn) thiz->rcswitch.switchOn((p1), (p2), (p3)); else thiz->rcswitch.switchOff((p1), (p2), (p3)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:65:69: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         switchOp3(*(*v8str), group->Int32Value(), devce->Int32Value());
                                                                     ^
../src/RCSwitchNode.h:20:85: note: in definition of macro ‘switchOp3’
 Op3(p1, p2, p3) { if(switchOn) thiz->rcswitch.switchOn((p1), (p2), (p3)); else thiz->rcswitch.switchOff((p1), (p2), (p3)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:65:48: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         switchOp3(*(*v8str), group->Int32Value(), devce->Int32Value());
                                                ^
../src/RCSwitchNode.h:20:128: note: in definition of macro ‘switchOp3’
 ch.switchOn((p1), (p2), (p3)); else thiz->rcswitch.switchOff((p1), (p2), (p3)); }
                                                                     ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/RCSwitchNode.cpp:1:0:
../src/RCSwitchNode.cpp:65:69: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
         switchOp3(*(*v8str), group->Int32Value(), devce->Int32Value());
                                                                     ^
../src/RCSwitchNode.h:20:134: note: in definition of macro ‘switchOp3’
 .switchOn((p1), (p2), (p3)); else thiz->rcswitch.switchOff((p1), (p2), (p3)); }
                                                                         ^~
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/RCSwitchNode.cpp:83:59: error: no matching function for call to ‘v8::Function::NewInstance(const int&, v8::Local<v8::Value> [0])’
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:4105:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>, int, v8::Local<v8::Value>*) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/root/.node-gyp/11.10.0/include/node/v8.h:4105:44: note:   candidate expects 3 arguments, 2 provided
/root/.node-gyp/11.10.0/include/node/v8.h:4108:44: note: candidate: v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const
   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
                                            ^~~~~~~~~~~
/root/.node-gyp/11.10.0/include/node/v8.h:4108:44: note:   candidate expects 1 argument, 2 provided
../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::EnableTransmit(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/RCSwitchNode.cpp:115:52: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     obj->rcswitch.enableTransmit(pinNr->Int32Value());
                                                    ^
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::SetProtocol(v8::Local<v8::String>, v8::Local<v8::Value>, const Nan::PropertyCallbackInfo<v8::Value>&)’:
../src/RCSwitchNode.cpp:144:49: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     obj->rcswitch.setProtocol(value->Int32Value());
                                                 ^
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/11.10.0/include/node/node.h:63,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:
/root/.node-gyp/11.10.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~

rcswitch.target.mk:103: recipe for target 'Release/obj.target/rcswitch/src/RCSwitchNode.o' failed
make: *** [Release/obj.target/rcswitch/src/RCSwitchNode.o] Error 1
make: Leaving directory '/root/node_modules/rcswitch/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.14.98+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/node_modules/rcswitch
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-02-28T08_54_13_818Z-debug.log
root@DietPi:~# 

@Lukcyluke Actually the "unnecessary console log" contains the actual error:

../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/RCSwitchNode.cpp:83:59: error: no matching function for call to ‘v8::Function::NewInstance(const int&, v8::Local<v8::Value> [0])’
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:

This error indicates that the module you are installing (rcswitch) hasn't been updated for newer versions of Node.js (see also https://github.com/marvinroger/node-rcswitch/issues/15).

@Lukcyluke Actually the "unnecessary console log" contains the actual error:

../src/RCSwitchNode.cpp: In static member function ‘static void RCSwitchNode::New(const Nan::FunctionCallbackInfo<v8::Value>&)’:
../src/RCSwitchNode.cpp:83:59: error: no matching function for call to ‘v8::Function::NewInstance(const int&, v8::Local<v8::Value> [0])’
     info.GetReturnValue().Set(cons->NewInstance(argc, argv));
                                                           ^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
                 from ../../nan/nan.h:53,
                 from ../src/RCSwitchNode.h:4,
                 from ../src/RCSwitchNode.cpp:1:

This error indicates that the module you are installing (rcswitch) hasn't been updated for newer versions of Node.js (see also marvinroger/node-rcswitch#15).
my windows node version is 10.9.0it’s ok
but my linux node version is 11.11.0。
Thank you very much。I changed my Linux version to 10.9.0 it‘s repaired。my english is not goodBut I think it's still necessary to thank you.

I faced same issue -
even after [sudo] npm explore npm -g -- npm install node-gyp@latest
npm uses old gyp version
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0

Was this page helpful?
0 / 5 - 0 ratings