Loghorn / ant-plus

A node module for ANT+
MIT License
141 stars 70 forks source link

FATAL ERROR: Error::Error napi_create_reference #50

Open AmphibianDev opened 2 years ago

AmphibianDev commented 2 years ago

Watch: Garmin vívomove Style

Usb: Name: CYCPLUS USB ANT STICK U1 (AliExpress) Manufacturer: Chengdu Chendian Intelligent Technology Co., Ltd. (text from the box) USB ID: 0FCF 1008 I have used "zadig-2.7.exe" to install WinUSB (v6.1.7600.16385)

Environment: Node: 16.17.0 Ant-Plus: 0.1.24 Windows 10

Code:

ar Ant = require("ant-plus");
var stick = new Ant.GarminStick2();      //GarminStick3 => Stick not found!
var sensor = new Ant.HeartRateSensor(stick);

sensor.on("hbData", function (data) {
  console.log(data.DeviceID, data.ComputedHeartRate);
});

stick.on("startup", function () {
  sensor.scan();
});

if (!stick.open()) {
  console.log("Stick not found!");
}

Output:

FATAL ERROR: Error::Error napi_create_reference
 1: 00007FF63958B1EF v8::internal::CodeObjectRegistry::~CodeObjectRegistry+123599
 2: 00007FF639518BA6 v8::internal::MicrotaskQueue::GetMicrotasksScopeDepth+65206
 3: 00007FF639519C7D node::OnFatalError+301
 4: 00007FF639519259 v8::internal::MicrotaskQueue::GetMicrotasksScopeDepth+66921
 5: 00007FF6395472EC napi_fatal_error+156
 6: 00007FF8D6771887
 7: 00007FF8D67717BE
 8: 00007FF8D6781C80
 9: 00007FF8D6782E44
10: 00007FF8D67724F8
11: 00007FF639545562 node_module_register+5458
12: 00007FF639544FE1 node_module_register+4049
13: 00007FF6395E8D0B uv_async_send+331
14: 00007FF6395E849C uv_loop_init+1292
15: 00007FF6395E863A uv_run+202
16: 00007FF6395B7725 node::SpinEventLoop+325
17: 00007FF6394D1FE1 cppgc::internal::NormalPageSpace::linear_allocation_buffer+51729
18: 00007FF63954CA3A node::Start+202
19: 00007FF6393786DC RC4_options+347612
20: 00007FF63A3CE3F8 v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+14520
21: 00007FF9060E7034 BaseThreadInitThunk+20
22: 00007FF9064626A1 RtlUserThreadStart+33

Can I resolve this or is my USB just incompatible and I need to buy the official one? Thanks

VirtualMarten commented 1 year ago

I have the same issue after the newest windows update with the official ANT+ Dongle.

UPDATE: Fixed by re-patching the driver with Zadig. Windows update did something weird to it.