Trying to connect to Puck from command line on OSX

Posted on
  • Hi,

    I've got my puck up and running using the web IDE but would like to connect and upload code via the command line on OSX. I have followed https://www.espruino.com/Puck.js+Quick+Start#command-line and installed the espruino node module and noble as well. When I run espruino --list all I get listed is PORTS: /dev/cu.Bluetooth-Incoming-Port and no puck addresses.

    Have I missed something?

  • Got it working! Seems it just needed a Firmware update.

  • Great - thanks for the update! It was probably just that as it shipped the Puck didn't transmit its information often enough - so the command-line app wasn't guaranteed to be able to see it (if you'd run it enough times you might have been able to connect eventually with the old firmware - but it's not great).

  • Hmmmm I did a firmware (1v90) upgrade too and tried the osx cli with "espruino --list" for sure 20 times but all I get is "PORTS: /dev/cu.Bluetooth-Incoming-Port" too.

    Any other ideas?
    Thanks
    Jens

  • Ok, never mind. Removing and inserting the battery solved it.
    Thanks.

  • Had you previously uploaded the BLE Keyboard code? It seems that's a common issue - it causes Mac OS to stay connected to it, which means that it is no longer connectable by anything else

  • Indeed I did. Thanks for the info.

  • I remember it once worked for me too.
    However, time moved on.
    It's 10.13.4 now and somehow it stopped working (espruino --list returns with an empty list - and also very quickly).

    Also trying to install noble (I guess it's needed) seems to have issues:

    1. $ npm install noble
    2. (...)
    3. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winnus@0.0.3 (node_modules/winnus):
    4. npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winnus@0.0.3: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
    5. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket):
    6. npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for bluetooth-hci-socket@0.5.1: wanted {"os":"linux,android,win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})

    btw:

    1. $ node --version
    2. v10.2.1

    Did anyone get this working?

  • Try espruino --list --verbose and see what it says. I don't believe those install warning are a problem.

    Can you connect to the Puck using the normal Web IDE? In newer versions of Mac OS Apple actually disabled external bluetooth adaptors that worked perfectly fine before, so that could be your problem if you do have an external adaptor. You'd have to get a Broadcom (not CSR) one - see http://www.espruino.com/Quick+Start+BLE

    Out of interest, was there a reason you added this to an old thread? Everyone seems to be adding to old threads rather than making new ones now and I wonder whether the forum is stopping you somehow?

  • @Gordon, thanks for the quick reply.

    Yes, Web IDE works.
    It's not an external bluetooth adapter, but the internal one of a MacBook Air 11"

    The reason I was adding to an old threat was that I found the thread during my troubleshooting and thought it could fit here for some continuity reasons - sorry. Also the original people involved may have experienced something similar or different meanwhile.
    I can start a new one if you think that is better.

    This is the output with verbose:

    1. $ espruino --list --verbose
    2. 0.1.9
    3. Espruino Command-line Tool 0.1.9
    4. -----------------------------------
    5. Acorn library not found - you'll need it for compiled code
    6. Found /usr/local/lib/node_modules/espruino/libs/targz.js
    7. Found /usr/local/lib/node_modules/espruino/libs/utf8.js
    8. Found /usr/local/lib/node_modules/espruino/espruino.js
    9. Found /usr/local/lib/node_modules/espruino/core/codeWriter.js
    10. Found /usr/local/lib/node_modules/espruino/core/config.js
    11. Found /usr/local/lib/node_modules/espruino/core/env.js
    12. Found /usr/local/lib/node_modules/espruino/core/flasher.js
    13. Found /usr/local/lib/node_modules/espruino/core/modules.js
    14. Found /usr/local/lib/node_modules/espruino/core/notifications.js
    15. Found /usr/local/lib/node_modules/espruino/core/serial.js
    16. Found /usr/local/lib/node_modules/espruino/core/serial_chrome_serial.js
    17. No chrome.serial - Chrome Serial disabled
    18. Found /usr/local/lib/node_modules/espruino/core/serial_chrome_socket.js
    19. No chrome.sockets - Chrome Socket disabled
    20. Found /usr/local/lib/node_modules/espruino/core/serial_frame.js
    21. Found /usr/local/lib/node_modules/espruino/core/serial_noble.js
    22. Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
    23. Error: The module '/usr/local/lib/node_modules/espruino/node_modules/xpc-connection/build/Release/binding.node'
    24. was compiled against a different Node.js version using
    25. NODE_MODULE_VERSION 48. This version of Node.js requires
    26. NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
    27. the module (for instance, using `npm rebuild` or `npm install`).
    28. at Object.Module._extensions..node (internal/modules/cjs/loader.js:731:18)
    29. at Module.load (internal/modules/cjs/loader.js:612:32)
    30. at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    31. at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    32. at Module.require (internal/modules/cjs/loader.js:650:17)
    33. at require (internal/modules/cjs/helpers.js:20:18)
    34. at Object.<anonymous> (/usr/local/lib/node_modules/espruino/node_modules/xpc-connection/index.js:3:15)
    35. at Module._compile (internal/modules/cjs/loader.js:702:30)
    36. at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    37. at Module.load (internal/modules/cjs/loader.js:612:32)
    38. Found /usr/local/lib/node_modules/espruino/core/serial_node_serial.js
    39. No 'serialport' module found
    40. Found /usr/local/lib/node_modules/espruino/core/serial_node_socket.js
    41. Found /usr/local/lib/node_modules/espruino/core/serial_web_audio.js
    42. Found /usr/local/lib/node_modules/espruino/core/serial_web_bluetooth.js
    43. Found /usr/local/lib/node_modules/espruino/core/serial_websocket_local.js
    44. Found /usr/local/lib/node_modules/espruino/core/serial_websocket_mqtt.js
    45. Found /usr/local/lib/node_modules/espruino/core/serial_websocket_relay.js
    46. Found /usr/local/lib/node_modules/espruino/core/serial_winnus.js
    47. Not on Windows, Winnus not needed
    48. Found /usr/local/lib/node_modules/espruino/core/terminal.js
    49. Found /usr/local/lib/node_modules/espruino/core/utils.js
    50. Found /usr/local/lib/node_modules/espruino/plugins/assembler.js
    51. Found /usr/local/lib/node_modules/espruino/plugins/boardJSON.js
    52. Found /usr/local/lib/node_modules/espruino/plugins/compiler.js
    53. Found /usr/local/lib/node_modules/espruino/plugins/getGitHub.js
    54. Found /usr/local/lib/node_modules/espruino/plugins/localModules.js
    55. Found /usr/local/lib/node_modules/espruino/plugins/minify.js
    56. Found /usr/local/lib/node_modules/espruino/plugins/saveOnSend.js
    57. Found /usr/local/lib/node_modules/espruino/plugins/setTime.js
    58. Found /usr/local/lib/node_modules/espruino/plugins/unicode.js
    59. Found /usr/local/lib/node_modules/espruino/plugins/versionChecker.js
    60. Initialising CodeWriter
    61. Initialising Config
    62. Initialising Env
    63. Initialising Flasher
    64. Initialising Modules
    65. Initialising Notifications
    66. Initialising Serial
    67. - Initialising Serial Node Socket
    68. - Initialising Serial Web Bluetooth
    69. Initialising Utils
    70. Initialising Status
    71. Initialising Assembler
    72. Initialising BoardJSON
    73. Initialising Compiler
    74. Initialising GetGitHub
    75. Initialising LocalModules
    76. Initialising Minify
    77. Initialising SaveOnSend
    78. Initialising SetTime
    79. Initialising Unicode
    80. Initialising VersionChecker
    81. Searching for serial ports...
    82. No navigator.bluetooth - Web Bluetooth not enabled
    83. PORTS:
  • No problem, it's fine - I just wondered whether there was a forum bug.

    1. Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
    2. Error: The module '/usr/local/lib/node_modules/espruino/node_modules/xpc-connection/build/Release/binding.node'
    3. was compiled against a different Node.js version using
    4. NODE_MODULE_VERSION 48. This version of Node.js requires
    5. NODE_MODULE_VERSION 64. Please try re-compiling or re-installing

    Well there's your problem :) I guess you had this all installed and then updated Node.js?

    Just remove espruino using NPM and re-install, and that should hopefully pull in new library versions and fix it.

  • This is one of the many things I already tried - and it didn't work:

    • reinstall node (even trying different versions)
    • reinstall espruino
    • reinstall noble

    I can try the same with my other MacBook when I'm back at home this evening.

  • In that case, if you see xpc-connection being installed by NPM and yet you still get the error, I think your version of NPM is old or misconfigured. It may not be apparent if you don't normally use native modules, but if you do then I imagine they'll break.

    I'd give that NODE_MODULE_VERSION error a google as I bet plenty of other people have hit it.

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

Trying to connect to Puck from command line on OSX

Posted by Avatar for alexjfno1 @alexjfno1

Actions