lsongdev / lsongdev/node-escpos

Bluetooth module is too old...

Open
#432 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.6k
Forks
443
PR merge metrics
No merged PRs in 30d

Description

Hey there,

I'm trying to install the Bluetooth module, however, it seems like it's running into a bunch of issues with node-gyp. Here is the full log:

```
npm i escpos-bluetooth
npm ERR! code 1
npm ERR! path /.../new-node-thermal-printer/node_modules/node-bluetooth
npm ERR! command failed
npm ERR! command sh -c node-gyp configure build
npm ERR! CXX(target) Release/obj.target/BluetoothSerialPort/src/osx/DeviceINQ.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@18.20.2 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.6 found at "/usr/local/bin/python3"
npm ERR! gyp info spawn /usr/local/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/.../new-node-thermal-printer/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/.../new-node-thermal-printer/node_modules/node-bluetooth/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/.../new-node-thermal-printer/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/.../Library/Caches/node-gyp/18.20.2/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/.../Library/Caches/node-gyp/18.20.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/.../new-node-thermal-printer/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/.../Library/Caches/node-gyp/18.20.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/.../new-node-thermal-printer/node_modules/node-bluetooth',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/osx/DeviceINQ.mm:75:16: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! found->Call(2, argv);
npm ERR! ^
npm ERR! ../../nan/nan.h:1747:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local
npm ERR! ^
npm ERR! ../../nan/nan.h:112:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:78:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! callback->Call(0, 0);
npm ERR! ^
npm ERR! ../../nan/nan.h:1747:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local
npm ERR! ^
npm ERR! ../../nan/nan.h:112:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:109:16: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! baton->cb->Call(1, argv);
npm ERR! ^
npm ERR! ../../nan/nan.h:1747:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local
npm ERR! ^
npm ERR! ../../nan/nan.h:112:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:121:28: error: expected ')'
npm ERR! void DeviceINQ::Init(Handle target) {
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:121:21: note: to match this '('
npm ERR! void DeviceINQ::Init(Handle target) {
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:121:17: error: out-of-line definition of 'Init' does not match any declaration in 'DeviceINQ'
npm ERR! void DeviceINQ::Init(Handle target) {
npm ERR! ^~~~
npm ERR! ../src/osx/DeviceINQ.mm:133:5: error: use of undeclared identifier 'target'
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:133:72: error: too few arguments to function call, single argument 'context' was not specified
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ~~~~~~~~~~~~~~ ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-template.h:513:46: note: 'GetFunction' declared here
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:134:5: error: use of undeclared identifier 'target'
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:134:72: error: too few arguments to function call, single argument 'context' was not specified
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ~~~~~~~~~~~~~~ ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-template.h:513:46: note: 'GetFunction' declared here
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:135:5: error: use of undeclared identifier 'target'
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:135:72: error: too few arguments to function call, single argument 'context' was not specified
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ~~~~~~~~~~~~~~ ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-template.h:513:46: note: 'GetFunction' declared here
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:136:5: error: use of undeclared identifier 'target'
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:136:72: error: too few arguments to function call, single argument 'context' was not specified
npm ERR! target->Set(Nan::New("DeviceINQ").ToLocalChecked(), t->GetFunction());
npm ERR! ~~~~~~~~~~~~~~ ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-template.h:513:46: note: 'GetFunction' declared here
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:228:16: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! found->Call(2, argv);
npm ERR! ^
npm ERR! ../../nan/nan.h:1747:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local
npm ERR! ^
npm ERR! ../../nan/nan.h:112:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:231:15: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR! callback->Call(0, 0);
npm ERR! ^
npm ERR! ../../nan/nan.h:1747:3: note: 'Call' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline v8::Local
npm ERR! ^
npm ERR! ../../nan/nan.h:112:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:246:23: error: no matching constructor for initialization of 'String::Utf8Value'
npm ERR! String::Utf8Value address(info[0]);
npm ERR! ^ ~~~~~~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-primitive.h:517:5: note: candidate constructor not viable: no known conversion from 'v8::Local' to 'const Utf8Value' for 1st argument
npm ERR! Utf8Value(const Utf8Value&) = delete;
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-primitive.h:510:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
npm ERR! Utf8Value(Isolate* isolate, Local obj);
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:297:20: error: no matching member function for call to 'Set'
npm ERR! deviceObj->Set(Nan::New("name").ToLocalChecked(), Nan::New([device.nameOrAddress UTF8String]).ToLocalChecked());
npm ERR! ~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:298:20: error: no matching member function for call to 'Set'
npm ERR! deviceObj->Set(Nan::New("address").ToLocalChecked(), Nan::New([device.addressString UTF8String]).ToLocalChecked());
npm ERR! ~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:308:25: error: no matching member function for call to 'Set'
npm ERR! serviceObj->Set(Nan::New("channel").ToLocalChecked(), Nan::New((int)channelID));
npm ERR! ~~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:311:29: error: no matching member function for call to 'Set'
npm ERR! serviceObj->Set(Nan::New("name").ToLocalChecked(), Nan::New([[service getServiceName] UTF8String]).ToLocalChecked());
npm ERR! ~~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:313:29: error: no matching member function for call to 'Set'
npm ERR! serviceObj->Set(Nan::New("name").ToLocalChecked(), Nan::Undefined());
npm ERR! ~~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:315:28: error: no matching member function for call to 'Set'
npm ERR! servicesArray->Set(j, serviceObj);
npm ERR! ~~~~~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:317:20: error: no matching member function for call to 'Set'
npm ERR! deviceObj->Set(Nan::New("services").ToLocalChecked(), servicesArray);
npm ERR! ~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! ../src/osx/DeviceINQ.mm:319:22: error: no matching member function for call to 'Set'
npm ERR! resultArray->Set(i, deviceObj);
npm ERR! ~~~~~~~~~~~~~^~~
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:246:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context,
npm ERR! ^
npm ERR! /Users/.../Library/Caches/node-gyp/18.20.2/include/node/v8-object.h:249:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
npm ERR! V8_WARN_UNUSED_RESULT Maybe Set(Local context, uint32_t index,
npm ERR! ^
npm ERR! fatal error: too many errors emitted, stopping now [-ferror-limit=]
npm ERR! 5 warnings and 20 errors generated.
npm ERR! make: *** [Release/obj.target/BluetoothSerialPort/src/osx/DeviceINQ.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess. (/.../new-node-thermal-printer/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 23.4.0
npm ERR! gyp ERR! command "/Users/.../.nvm/versions/node/v18.20.2/bin/node" "/.../new-node-thermal-printer/node_modules/.bin/node-gyp" "configure" "build"
npm ERR! gyp ERR! cwd /.../new-node-thermal-printer/node_modules/node-bluetooth
npm ERR! gyp ERR! node -v v18.20.2
npm ERR! gyp ERR! node-gyp -v v10.1.0
npm ERR! gyp ERR! not ok

```

From searching around on the interweb, I can see that a lot of people recommend downgrading to ~node 10. This unfortunately isn't a viable options for me with the system I'm trying to build. I've also tried all the alternative options, such as removing everything under `node_modules` and changing my node version (moved down to 18 with no luck) and doing a global install of a more updated version of `node-gyp`.

Are there any chances that either someone can point at what I'm doing wrong or suggest a way to get around this, or what's probably best for the package, to migrate to a different Bluetooth package?

Thanks in advance :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing `npm i escpos-bluetooth` on Node 18.20.2 and macOS arm64, then inspect `node_modules/node-bluetooth/src/osx/DeviceINQ.mm` and the node-gyp output for the failing native API calls. Done means the Bluetooth module builds successfully in the reported environment without the listed compilation errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.