apihlaja / node-irsdk

iRacing SDK implementation for Node.js.
https://apihlaja.github.io/node-irsdk
MIT License
102 stars 55 forks source link

Error installing on Node v14 #94

Open JacenBoy opened 3 years ago

JacenBoy commented 3 years ago

When trying to install on Node v14, the build process errors.

> node-irsdk@2.1.6 install C:\Users\jacen\Documents\kandagawa\node_modules\node-irsdk
> prebuild-install || node-gyp rebuild

prebuild-install WARN install No prebuilt binaries found (target=14.15.1 runtime=node arch=x64 libc= platform=win32)

C:\Users\jacen\Documents\kandagawa\node_modules\node-irsdk>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  IrSdkNodeBindings.cpp
  IrSdkCommand.cpp
  IRSDKWrapper.cpp
  IrSdkBindingHelpers.cpp
  win_delay_load_hook.cc
c:\users\jacen\documents\kandagawa\node_modules\node-irsdk\src\cpp\irsdknodebindings.h(39): warning C4996: 'node::AtExi
t': was declared deprecated (compiling source file ..\src\cpp\IrSdkNodeBindings.cpp) [C:\Users\jacen\Documents\kandagaw
a\node_modules\node-irsdk\build\IrSdkNodeBindings.vcxproj]
  c:\users\jacen\appdata\local\node-gyp\cache\14.15.1\include\node\node.h(852): note: see declaration of 'node::AtExit'
   (compiling source file ..\src\cpp\IrSdkNodeBindings.cpp)
c:\users\jacen\documents\kandagawa\node_modules\node-irsdk\src\cpp\irsdkbindinghelpers.cpp(52): error C2661: 'v8::Objec
t::Set': no overloaded function takes 2 arguments [C:\Users\jacen\Documents\kandagawa\node_modules\node-irsdk\build\IrS
dkNodeBindings.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jacen\Documents\kandagawa\node_modules\node-irsdk
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-irsdk@2.1.6 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-irsdk@2.1.6 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!     C:\Users\jacen\AppData\Roaming\npm-cache\_logs\2020-11-30T00_37_05_432Z-debug.log

I tested on a fresh Windows installation, and the build process completes without issue on Node v8, but errors once upgraded to Node v14.

alvarovazquez commented 3 years ago

I can reproduce the error. Seems that this project is not mainained anymore. I will try to find a a solution for this, although mi knowledge of C is null :)

martinguder commented 3 years ago

Take a look here: https://github.com/apihlaja/node-irsdk/issues/86#issuecomment-627500181

Probably that solves your problem. It did with another previous version of node, which showed similar errors.

alvarovazquez commented 3 years ago

There is one error and one warning. To fix the error I changed IrSdkBindingHelpers.cpp:52 to Nan::Set(arr, i, convertTelemetryValueToObject(var, i));. The warning is still there but the project compiled and it's working!

martinguder commented 3 years ago

You still have to change the line 52 on IrSdkBindingHelpers.cpp in the node_modules/node-irsdk/src/cpp/

from arr->Set(i, convertTelemetryValueToObject(var, i)); to Nan::Set(arr, i, convertTelemetryValueToObject(var, i));

Then the rebuild should work without errors.

sabifa commented 3 years ago

You can also take a look at PR #93 which I have created based on Martins findings