node-irsdk
node-irsdk copied to clipboard
Prebuild / NPM install fails on macOS
Is it possible to install this repo also on macOS and develop everything there? Or is Windows mandatory? I get this error when installing with npm on macOS:
prebuild-install WARN install No prebuilt binaries found (target=12.10.0 runtime=node arch=x64 libc= platform=darwin)
CXX(target) Release/obj.target/IrSdkNodeBindings/src/cpp/IrSdkNodeBindings.o
../src/cpp/IrSdkNodeBindings.cpp:1:12: warning: #pragma once in main file [-Wpragma-once-outside-header]
<U+FEFF>#pragma once
^
In file included from ../src/cpp/IrSdkNodeBindings.cpp:3:
In file included from ../src/cpp/IRSDKWrapper.h:3:
../src/cpp/irsdk/irsdk_defines.h:84:10: fatal error: 'tchar.h' file not found
#include <tchar.h>
^~~~~~~~~
1 warning and 1 error generated.
make: *** [Release/obj.target/IrSdkNodeBindings/src/cpp/IrSdkNodeBindings.o] Error 1
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:196:23)
gyp ERR! stack at ChildProcess.emit (events.js:209:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
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 /Users/username/Documents/Github/iracing/node_modules/node-irsdk
gyp ERR! node -v v12.10.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-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.
I have XCode and Command Line Tools installed. Running node v12.10.0 and npm v6.10.3 …
Maybe one addition: I ran everything on Windows 10 with Git Bash and install was flawless and got telemetry data output as easy as it can be. But usually I just don't like to develop on my gaming machine.
It seems, that the tchar.h file is by the MS compiler and deals with ANSI / Unicode encoding. Hard to say, if there is anything, that can be added here to make it compile on non-Windows platforms. So my key take-away here is, that it's right now just possible to prebuild/compile under Windows right?
Found this short thread that describes the problem (right?): https://www.experts-exchange.com/questions/24264430/Is-there-a-TCHAR-lib-for-Mac-OS.html
I think that'd fix the issue: https://github.com/apihlaja/node-irsdk/issues/53
Then you could define node-irsdk as optional dependency in your package.json and it wouldnt be installed on Mac. Ofc, you might need some kind of mock or data bridge depending what you do.
Or are you actually running iRacing under MacOS? Because otherwise it doesnt make much sense to have node-irsdk installed either.
I'm not a pro in terms of this (just a designers side project), but I will try to implement it this way. The thing is, that I mostly develop under macOS, especially on the go and just do the testing later on Windows. I also tried to let this run in a VM under Windows, but there are major hickups of all kind with node.js, gitBash etc. ... not sure why. But thanks anyway.
Under native Windows installation I got everything up and running within minutes on my gaming machine and I already know how the whole data looks like, so that would have been easy to just develop my prototype further based on that. But I'll report back, as soon as I figured this out.
Edit: of course I could add a data bridge via UDP or websockets as a step in between. But that doesn't really solve the problem and is kind of hacky.
I think the next step would be that I complete #53, then you can test if optionalDependency works as expected. I should make a new release anyway because of Node.js v12 binaries.
That would be great. :) Any plans when you are ready to do that?
Hi. Do you have any updates or can give me instructions on how/where to make the necessary changes?
@martinguder I use the approach @apihlaja alluded to, using captured data. I find it much easier to prototype against reproducible data. I did the following:
- Use https://github.com/apihlaja/node-irsdk/blob/master/utils/recorder.js on the PC to capture data.
- Temporarily remove node-irsdk from my package.json on the Mac to get all my app's required modules.
- In my app, have an option to replay portions of the captured data.
I've thought of hiding the replay code behind with something like irsdk.getReplayInstance (speculated), but haven't done so.
That's fine for prototyping, yes. But in addition this would have been nice to have. Meanwhile I ran into the same problem as others, when continuing with Win 10 and wanted to use Electron and that led to the next problem: it does not run with Electron v7 upwards anymore. Actually this project seems to be dead unfortunately, even though others offered to help and continue the development on this branch. Very sad. :(