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:

    $ npm install noble
    (...)
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: winnus@0.0.3 (node_modules/winnus):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for winnus@0.0.3: wanted {"os":"win32","arch":"any"} (current: {"os":"darwin","arch":"x64"})
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: bluetooth-hci-socket@0.5.1 (node_modules/bluetooth-hci-socket):
    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:

    $ node --version
    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:

    $ espruino --list --verbose
    0.1.9
    Espruino Command-line Tool 0.1.9
    -----------------------------------
    
    Acorn library not found - you'll need it for compiled code
    Found /usr/local/lib/node_modules/espruino/libs/targz.js
    Found /usr/local/lib/node_modules/espruino/libs/utf8.js
    Found /usr/local/lib/node_modules/espruino/espruino.js
    Found /usr/local/lib/node_modules/espruino/core/codeWriter.js
    Found /usr/local/lib/node_modules/espruino/core/config.js
    Found /usr/local/lib/node_modules/espruino/core/env.js
    Found /usr/local/lib/node_modules/espruino/core/flasher.js
    Found /usr/local/lib/node_modules/espruino/core/modules.js
    Found /usr/local/lib/node_modules/espruino/core/notifications.js
    Found /usr/local/lib/node_modules/espruino/core/serial.js
    Found /usr/local/lib/node_modules/espruino/core/serial_chrome_serial.js
    No chrome.serial - Chrome Serial disabled
    Found /usr/local/lib/node_modules/espruino/core/serial_chrome_socket.js
    No chrome.sockets - Chrome Socket disabled
    Found /usr/local/lib/node_modules/espruino/core/serial_frame.js
    Found /usr/local/lib/node_modules/espruino/core/serial_noble.js
    Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
     Error: The module '/usr/local/lib/node_modules/espruino/node_modules/xpc-connection/build/Release/binding.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 48. This version of Node.js requires
    NODE_MODULE_VERSION 64. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
        at Object.Module._extensions..node (internal/modules/cjs/loader.js:731:18)
        at Module.load (internal/modules/cjs/loader.js:612:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
        at Function.Module._load (internal/modules/cjs/loader.js:543:3)
        at Module.require (internal/modules/cjs/loader.js:650:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at Object.<anonymous> (/usr/local/lib/node_modules/espruino/node_modules/xpc-connection/index.js:3:15)
        at Module._compile (internal/modules/cjs/loader.js:702:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
        at Module.load (internal/modules/cjs/loader.js:612:32)
    Found /usr/local/lib/node_modules/espruino/core/serial_node_serial.js
    No 'serialport' module found
    Found /usr/local/lib/node_modules/espruino/core/serial_node_socket.js
    Found /usr/local/lib/node_modules/espruino/core/serial_web_audio.js
    Found /usr/local/lib/node_modules/espruino/core/serial_web_bluetooth.js
    Found /usr/local/lib/node_modules/espruino/core/serial_websocket_local.js
    Found /usr/local/lib/node_modules/espruino/core/serial_websocket_mqtt.js
    Found /usr/local/lib/node_modules/espruino/core/serial_websocket_relay.js
    Found /usr/local/lib/node_modules/espruino/core/serial_winnus.js
    Not on Windows, Winnus not needed
    Found /usr/local/lib/node_modules/espruino/core/terminal.js
    Found /usr/local/lib/node_modules/espruino/core/utils.js
    Found /usr/local/lib/node_modules/espruino/plugins/assembler.js
    Found /usr/local/lib/node_modules/espruino/plugins/boardJSON.js
    Found /usr/local/lib/node_modules/espruino/plugins/compiler.js
    Found /usr/local/lib/node_modules/espruino/plugins/getGitHub.js
    Found /usr/local/lib/node_modules/espruino/plugins/localModules.js
    Found /usr/local/lib/node_modules/espruino/plugins/minify.js
    Found /usr/local/lib/node_modules/espruino/plugins/saveOnSend.js
    Found /usr/local/lib/node_modules/espruino/plugins/setTime.js
    Found /usr/local/lib/node_modules/espruino/plugins/unicode.js
    Found /usr/local/lib/node_modules/espruino/plugins/versionChecker.js
    Initialising CodeWriter
    Initialising Config
    Initialising Env
    Initialising Flasher
    Initialising Modules
    Initialising Notifications
    Initialising Serial
      - Initialising Serial Node Socket
      - Initialising Serial Web Bluetooth
    Initialising Utils
    Initialising Status
    Initialising Assembler
    Initialising BoardJSON
    Initialising Compiler
    Initialising GetGitHub
    Initialising LocalModules
    Initialising Minify
    Initialising SaveOnSend
    Initialising SetTime
    Initialising Unicode
    Initialising VersionChecker
    Searching for serial ports...
    No navigator.bluetooth - Web Bluetooth not enabled
    PORTS:
    
    
  • No problem, it's fine - I just wondered whether there was a forum bug.

    Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
     Error: The module '/usr/local/lib/node_modules/espruino/no­de_modules/xpc-connection/build/Release/­binding.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 48. This version of Node.js requires
    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
About

Trying to connect to Puck from command line on OSX

Posted by Avatar for alexjfno1 @alexjfno1

Actions