Espruino command-line app error: No Ports Found

Posted on
  • Hello, this is my specs:

    1. Debian sid
    2. $ sudo lsusb |grep Bluetooth # Bus 001 Device 006: ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)
    3. sudo setcap cap_net_raw+eip $(eval readlink -f which node) # already executed

    I want to use Web Bluetooth with the Espruino command-line app. However, it says "Error: No Ports Found". The output:

    $ espruino --list --verbose
    0.1.45
    Espruino Command-line Tool 0.1.45
    -----------------------------------
    
    Acorn library not found - you'll need it for compiled code
    Found /usr/local/lib/node_modules/espruino/lib­s/targz.js
    Found /usr/local/lib/node_modules/espruino/lib­s/utf8.js
    Found /usr/local/lib/node_modules/espruino/lib­s/esprima/escodegen.js
    Found /usr/local/lib/node_modules/espruino/lib­s/esprima/esmangle.js
    Found /usr/local/lib/node_modules/espruino/lib­s/esprima/esprima.js
    Found /usr/local/lib/node_modules/espruino/esp­ruino.js
    Found /usr/local/lib/node_modules/espruino/cor­e/codeWriter.js
    Found /usr/local/lib/node_modules/espruino/cor­e/config.js
    Found /usr/local/lib/node_modules/espruino/cor­e/env.js
    Found /usr/local/lib/node_modules/espruino/cor­e/flasher.js
    Found /usr/local/lib/node_modules/espruino/cor­e/flasherESP8266.js
    Found /usr/local/lib/node_modules/espruino/cor­e/modules.js
    Found /usr/local/lib/node_modules/espruino/cor­e/notifications.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_chrome_serial.js
    No chrome.serial - Chrome Serial disabled
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_chrome_socket.js
    No chrome.sockets - Chrome Socket disabled
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_frame.js
    serial_frame: Not running in a browser
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_noble.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_node_serial.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_node_socket.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_web_audio.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_web_bluetooth.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_web_serial.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_websocket_local.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_websocket_relay.js
    Found /usr/local/lib/node_modules/espruino/cor­e/serial_winnus.js
    Not on Windows, Winnus not needed
    Found /usr/local/lib/node_modules/espruino/cor­e/terminal.js
    Found /usr/local/lib/node_modules/espruino/cor­e/utils.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/assembler.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/boardJSON.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/compiler.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/getGitHub.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/localModules.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/minify.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/pretokenise.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/saveOnSend.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/setTime.js
    Found /usr/local/lib/node_modules/espruino/plu­gins/unicode.js
    UTF8 Library loaded successfully
    Found /usr/local/lib/node_modules/espruino/plu­gins/versionChecker.js
    Initialising CodeWriter
    Initialising Config
    Initialising Env
    Initialising Flasher
    Initialising FlasherESP8266
    Initialising Modules
    Initialising Notifications
    Initialising Serial
      - Initialising Serial Noble Bluetooth LE
      - Initialising Serial Node Serial
      - Initialising Serial Node Socket
      - Initialising Serial Web Audio
      - Initialising Serial Web Bluetooth
      - Initialising Serial Web Serial
    Initialising Utils
    Initialising Status
    Initialising Assembler
    Initialising BoardJSON
    Initialising Compiler
    Initialising GetGitHub
    Initialising LocalModules
    Initialising Minify
    Initialising Unicode
    Initialising VersionChecker
    Initialising CoreModules
    Initialising Pretokenise
    Initialising SaveOnSend
    Initialising SetTime
    Searching for serial ports...
    Noble: getPorts - initialising...
    Noble: stateChange -> poweredOn
    Noble: Disable Web Bluetooth as we have Noble instead
    Noble: Starting scan
    Error: No Ports Found
    

    Is it the Intel bluetooth adapter or something else?

  • Hi,

    Thanks for the log - that's odd - it looks like Noble is installed and doing all the right stuff, it's just not finding anything.

    At the console, does sudo hcitool lescan list any devices for you?

    And please could you try running the code from https://www.espruino.com/BLE+Advertising­#node-js (and remove the if (!peripheral.advertisement.manufacturerD­ata) return; line) and see if it reports anything?

    It's possible that it's just that your Bangle is already connected to something (your phone?) so is not connectable?

  • $ sudo hcitool lescan
    Set scan parameters failed: Input/output error
    

    I tried the suggestions here but to no avail. Also found this launchpad bug.

    $ node advertising_nodejs.js
    node:internal/modules/cjs/loader:1042
      throw err;
      ^
    
    Error: Cannot find module 'bluetooth-hci-socket'
    Require stack:
    - /home/user/node_modules/noble/lib/hci-so­cket/hci.js
    - /home/user/node_modules/noble/lib/hci-so­cket/bindings.js
    - /home/user/node_modules/noble/lib/resolv­e-bindings.js
    - /home/user/node_modules/noble/index.js
    - /home/user/advertising_nodejs.js
        at Module._resolveFilename (node:internal/modules/cjs/loader:1039:1­5)
        at Module._load (node:internal/modules/cjs/loader:885:27­)
        at Module.require (node:internal/modules/cjs/loader:1105:1­9)
        at require (node:internal/modules/cjs/helpers:103:1­8)
        at Object.<anonymous> (/home/user/node_modules/noble/lib/hci-s­ocket/hci.js:6:26)
        at Module._compile (node:internal/modules/cjs/loader:1218:1­4)
        at Module._extensions..js (node:internal/modules/cjs/loader:1272:1­0)
        at Module.load (node:internal/modules/cjs/loader:1081:3­2)
        at Module._load (node:internal/modules/cjs/loader:922:12­)
        at Module.require (node:internal/modules/cjs/loader:1105:1­9) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [
        '/home/user/node_modules/noble/lib/hci-s­ocket/hci.js',
        '/home/user/node_modules/noble/lib/hci-s­ocket/bindings.js',
        '/home/user/node_modules/noble/lib/resol­ve-bindings.js',
        '/home/user/node_modules/noble/index.js'­,
        '/home/user/advertising_nodejs.js'
      ]
    }
    
    Node.js v18.13.0
    

    Then tried this. Now getting

    $ sudo npm install bluetooth-hci-socket --unsafe-perm
    npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@3. I'll try to do my best with it!
    
    > usb@1.9.2 install /home/user/node_modules/usb
    > node-gyp-build
    
    gyp ERR! configure error 
    gyp ERR! stack Error: Python executable "/usr/bin/python" is v3.11.1, which is not supported by gyp.
    gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
    gyp ERR! stack     at PythonFinder.failPythonVersion (/usr/local/lib/node_modules/npm/node_mo­dules/node-gyp/lib/configure.js:492:19)
    gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_mo­dules/node-gyp/lib/configure.js:474:14)
    gyp ERR! stack     at ChildProcess.exithandler (child_process.js:267:7)
    gyp ERR! stack     at emitTwo (events.js:126:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    gyp ERR! System Linux 6.1.7-2-siduction-amd64
    gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_mo­dules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /home/user/node_modules/usb
    gyp ERR! node -v v8.9.0
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok 
    
    > bluetooth-hci-socket@0.5.1 install /home/user/node_modules/bluetooth-hci-so­cket
    > node-gyp rebuild
    
    gyp ERR! configure error 
    gyp ERR! stack Error: Python executable "/usr/bin/python" is v3.11.1, which is not supported by gyp.
    gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
    gyp ERR! stack     at PythonFinder.failPythonVersion (/usr/local/lib/node_modules/npm/node_mo­dules/node-gyp/lib/configure.js:492:19)
    gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_mo­dules/node-gyp/lib/configure.js:474:14)
    gyp ERR! stack     at ChildProcess.exithandler (child_process.js:267:7)
    gyp ERR! stack     at emitTwo (events.js:126:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack     at maybeClose (internal/child_process.js:925:16)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    gyp ERR! System Linux 6.1.7-2-siduction-amd64
    gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_mo­dules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /home/user/node_modules/bluetooth-hci-so­cket
    gyp ERR! node -v v8.9.0
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok 
    npm WARN user No description
    npm WARN user No repository field.
    npm WARN user No license field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.9.2 (node_modules/usb):
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: usb@1.9.2 install: `node-gyp-build`
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! bluetooth-hci-socket@0.5.1 install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the bluetooth-hci-socket@0.5.1 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/2023-01-24T17_04_32_579­Z-debug.log
    
  • PS: The bangle is not connected otherwise.

    Did a fresh node install. advertising_nodejs.js gives same error. Then without sudo uses different Python version (3.9) but gives some other error:

    $ npm install bluetooth-hci-socket
    npm ERR! code 1
    npm ERR! path /home/user/node_modules/bluetooth-hci-so­cket
    npm ERR! command failed
    npm ERR! command sh -c node-gyp rebuild
    npm ERR! make: Verzeichnis „/home/user/node_modules/bluetooth-hci-s­ocket/build“ wird betreten
    npm ERR!   CXX(target) Release/obj.target/binding/src/Bluetooth­HciSocket.o
    npm ERR! make: Verzeichnis „/home/user/node_modules/bluetooth-hci-s­ocket/build“ wird verlassen
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.3.0
    npm ERR! gyp info using node@19.4.0 | linux | x64
    npm ERR! gyp info find Python using Python version 3.9.7 found at "/home/user/miniconda3/bin/python3"
    npm ERR! gyp info spawn /home/user/miniconda3/bin/python3
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/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   '/home/user/node_modules/bluetooth-hci-s­ocket/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/­node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/home/user/.cache/node-gyp/19.4.0/inclu­de/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=/home/user/.cache/node-­gyp/19.4.0',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/np­m/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/user/.cache/node-­gyp/19.4.0/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/user/node_modul­es/bluetooth-hci-socket',
    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/BluetoothHciSocket.cpp: In static member function ‘static void BluetoothHciSocket::Init(Nan::ADDON_REGI­STER_FUNCTION_ARGS_TYPE)’:
    npm ERR! ../src/BluetoothHciSocket.cpp:128:81: error: no matching function for call to ‘v8::FunctionTemplate::GetFunction()’
    npm ERR!   128 |   target->Set(Nan::New("BluetoothHciSocket­").ToLocalChecked(), tmpl->GetFunction());
    npm ERR!       |                                                                ~~~~~~~~~~~~~~~~~^~
    npm ERR! In file included from /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-function.h:15,
    npm ERR!                  from /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8.h:33,
    npm ERR!                  from /home/user/.cache/node-gyp/19.4.0/includ­e/node/node.h:73,
    npm ERR!                  from /home/user/.cache/node-gyp/19.4.0/includ­e/node/node_buffer.h:25,
    npm ERR!                  from ../src/BluetoothHciSocket.cpp:7:
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-template.h:495:46: note: candidate: ‘v8::MaybeLocal<v8::Function> v8::FunctionTemplate::GetFunction(v8::Lo­cal<v8::Context>)’
    npm ERR!   495 |   V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
    npm ERR!       |                                              ^~~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-template.h:495:46: note:   candidate expects 1 argument, 0 provided
    npm ERR! ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::poll()’:
    npm ERR! ../src/BluetoothHciSocket.cpp:251:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>,­ v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
    npm ERR!   251 |     Nan::MakeCallback(Nan::New<Object>(this-­>This), Nan::New("emit").ToLocalChecked(), 2, argv);
    npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~
    npm ERR! In file included from ../src/BluetoothHciSocket.cpp:8:
    npm ERR! ../../nan/nan.h:1051:46: note: declared here
    npm ERR!  1051 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
    npm ERR!       |                                              ^~~~~~~~~~~~
    npm ERR! ../src/BluetoothHciSocket.cpp: In member function ‘void BluetoothHciSocket::emitErrnoError()’:
    npm ERR! ../src/BluetoothHciSocket.cpp:269:74: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>)’­
    npm ERR!   269 |   Local<Function> errorConstructor = Local<Function>::Cast(globalObj->Get(Nan­::New("Error").ToLocalChecked()));
    npm ERR!       |                                                            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~
    npm ERR! In file included from /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-array-buffer.h:13,
    npm ERR!                  from /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8.h:24:
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-object.h:290:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
    npm ERR!   290 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
    npm ERR!       |                                           ^~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-object.h:290:43: note:   candidate expects 2 arguments, 1 provided
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-object.h:293:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
    npm ERR!   293 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
    npm ERR!       |                                           ^~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-object.h:293:43: note:   candidate expects 2 arguments, 1 provided
    npm ERR! ../src/BluetoothHciSocket.cpp:275:53: error: no matching function for call to ‘v8::Function::NewInstance(int, v8::Local<v8::Value> [1])’
    npm ERR!   275 |   Local<Value> error = errorConstructor->NewInstance(1, constructorArgs);
    npm ERR!       |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~­~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-function.h:38:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::­Context>, int, v8::Local<v8::Value>*) const’
    npm ERR!    38 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
    npm ERR!       |                                            ^~~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-function.h:38:44: note:   candidate expects 3 arguments, 2 provided
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-function.h:41:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::­Context>) const’
    npm ERR!    41 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstance(
    npm ERR!       |                                            ^~~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-function.h:41:44: note:   candidate expects 1 argument, 2 provided
    npm ERR! ../src/BluetoothHciSocket.cpp:282:20: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>,­ v8::Local<v8::String>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
    npm ERR!   282 |   Nan::MakeCallback(Nan::New<Object>(this-­>This), Nan::New("emit").ToLocalChecked(), 2, argv);
    npm ERR!       |   ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~
    npm ERR! ../../nan/nan.h:1051:46: note: declared here
    npm ERR!  1051 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
    npm ERR!       |                                              ^~~~~~~~~~~~
    npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindRaw(Nan::NAN_MET­HOD_ARGS_TYPE)’:
    npm ERR! ../src/BluetoothHciSocket.cpp:395:33: error: no matching function for call to ‘v8::Value::IntegerValue()’
    npm ERR!   395 |       devId = arg0->IntegerValue();
    npm ERR!       |               ~~~~~~~~~~~~~~~~~~^~
    npm ERR! In file included from /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-primitive.h:11,
    npm ERR!                  from /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-object.h:11:
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-value.h:413:40: note: candidate: ‘v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Co­ntext>) const’
    npm ERR!   413 |   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
    npm ERR!       |                                        ^~~~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-value.h:413:40: note:   candidate expects 1 argument, 0 provided
    npm ERR! ../src/BluetoothHciSocket.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindUser(Nan::NAN_ME­THOD_ARGS_TYPE)’:
    npm ERR! ../src/BluetoothHciSocket.cpp:417:33: error: no matching function for call to ‘v8::Value::IntegerValue()’
    npm ERR!   417 |       devId = arg0->IntegerValue();
    npm ERR!       |               ~~~~~~~~~~~~~~~~~~^~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-value.h:413:40: note: candidate: ‘v8::Maybe<long int> v8::Value::IntegerValue(v8::Local<v8::Co­ntext>) const’
    npm ERR!   413 |   V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
    npm ERR!       |                                        ^~~~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/v8-value.h:413:40: note:   candidate expects 1 argument, 0 provided
    npm ERR! ../src/BluetoothHciSocket.cpp: At global scope:
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/node.h:993:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TY­PE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
    npm ERR!   993 |       (node::addon_register_func) (regfunc),                          \
    npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    npm ERR! /home/user/.cache/node-gyp/19.4.0/includ­e/node/node.h:1027:3: note: in expansion of macro ‘NODE_MODULE_X’
    npm ERR!  1027 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
    npm ERR!       |   ^~~~~~~~~~~~~
    npm ERR! ../src/BluetoothHciSocket.cpp:499:1: note: in expansion of macro ‘NODE_MODULE’
    npm ERR!   499 | NODE_MODULE(binding, BluetoothHciSocket::Init);
    npm ERR!       | ^~~~~~~~~~~
    npm ERR! make: *** [binding.target.mk:113: Release/obj.target/binding/src/Bluetooth­HciSocket.o] Fehler 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.onExit (/usr/lib/node_modules/npm/node_modules/­node-gyp/lib/build.js:203:23)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
    npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:293:12)
    npm ERR! gyp ERR! System Linux 6.1.7-2-siduction-amd64
    npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/­node-gyp/bin/node-gyp.js" "rebuild"
    npm ERR! gyp ERR! cwd /home/user/node_modules/bluetooth-hci-so­cket
    npm ERR! gyp ERR! node -v v19.4.0
    npm ERR! gyp ERR! node-gyp -v v9.3.0
    npm ERR! gyp ERR! not ok
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/user/.npm/_logs/2023-01-24T18_12_1­1_130Z-debug-0.log
    
  • Hi, I think if the following happens:

    $ sudo hcitool lescan
    Set scan parameters failed: Input/output error
    

    Then this is something to do with the bluetooth setup in Linux - I'd try and look into that before spending time on Node.js, as I think that'll end up being the root cause of your problems. If that's not working I doubt Node.js will ever work despite what you try.

    Am I right in thinking you couldn't use Web Bluetooth from Chrome on the desktop to connect either?

    Is Bluetooth enabled in the Bluetooth Manager on the desktop?

    And do you have the device firmware packages installed on your OS? Sometimes folks don't install them because they're non-free but then it breaks a bunch of stuff

    I'm not really sure what to suggest - you may have some luck adding a $5 bluetooth USB adaptor and then blocklisting the driver for whatever existing bluetooth adaptor you have? That could be the easiest way in the end.

    ... but at the end of the day, my knowledge of debugging Linux internals is reasonably limited I'm afraid. You could try booting into a standard Ubuntu Live CD image and see if you have any more success there? At least it might narrow it down...

  • Am I right in thinking you couldn't use Web Bluetooth from Chrome on
    the desktop to connect either?

    I don't want to, since I see Chrome as a security concern. I tried Opera with all the neccesary settings for Web BT enabled but the Web IDE did not list Web BT as a port. Here's the log:

    No chrome.serial - Chrome Serial disabled
    No chrome.sockets - Chrome Socket disabled
    WebSocket relay support enabled - running in web browser
    serial_frame: Not running inside an iframe
    UTF8 Library loaded successfully
    No chrome.storage API - disabling Offline mode
    GET window.localStorage = null
    Initialising SettingsConsole
    Initialising Utils
    Initialising Config
    Initialising HTML
    Initialising Notifications
    Initialising Status
    Initialising App
    Initialising File
    Initialising Code
    Initialising Serial
      - Initialising Serial Web Audio
      - Initialising Serial Web Bluetooth
      - Initialising Serial Web Serial
    Serial> serial.getPorts exists - grab known devices
      - Initialising Serial Websocket Relay
      - Initialising Serial Emulator
    Initialising SerialWebSocketRelay
    Initialising Terminal
    Initialising CodeWriter
    Initialising Modules
    Initialising Env
    Initialising Flasher
    Initialising FlasherESP8266
    Initialising EditorBlockly
    Initialising EditorJavaScript
    Initialising Send
    Initialising MenuPortSelector
    Initialising MenuSettings
    Initialising MenuFlasher
    Initialising SettingsAbout
    Initialising SettingsFlasher
    Initialising BoardJSON
    Initialising VersionChecker
    Initialising Compiler
    Initialising Assembler
    Initialising GetGitHub
    Initialising Unicode
    Initialising Minify
    Initialising Tutorial
    Initialising Webcam
    Initialising FontSize
    Initialising UiMode
    Initialising URLHandler
    Initialising CodeLink
    Initialising Project
    Initialising Testing
    Initialising Notification_Sound
    Initialising Tern
    Initialising Debugger
    Initialising Tour
    Initialising SettingsProfile
    Initialising HelpLinks
    Initialising Arrows
    Initialising Storage
    Initialising KeyShortcuts
    Initialising TerminalLogger
    Initialising CoreModules
    Initialising Pretokenise
    Initialising SaveOnSend
    Initialising SetTime
    Loaded code from local storage.
    serviceworker> active
    Handling URL \"https://www.espruino.com/ide/#\"
    ERROR: getURL(\"/serial/ports\") error : HTTP 404
    /serial/ports doesn't exist - disabling WebSocket support
    

    Is Bluetooth enabled in the Bluetooth Manager on the desktop?

    Yes, "standard" BT scanning works.

    And do you have the device firmware packages installed on your OS? Sometimes folks don't install them because they're non-free but then it breaks a bunch of stuff

    The BT firmware is not listed by fwupdmgr get-devices

    I'm not really sure what to suggest - you may have some luck adding a $5 bluetooth USB adaptor and then blocklisting the driver for whatever existing bluetooth adaptor you have? That could be the easiest way in the end.

    I will try that, thanks.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino command-line app error: No Ports Found

Posted by Avatar for user152434 @user152434

Actions