TypeError: serialport.list is not a function (board.js line 42)

Author: manno-xxCreated Jun 16, 2022Updated May 3, 2024

I'm trying to connect my macbook (year 2018, running monterey) to an arduino. When running the standard blink example as a test, I get the error:

    serialport.list().then(results => {
              
TypeError: serialport.list is not a function
    at Board.detect (/Users/manno/node_modules/johnny-five/lib/board.js:42:16)
    at new Board (/Users/manno/node_modules/johnny-five/lib/board.js:291:23)
    at Object.<anonymous> (/Users/manno/[some more path]/NodeWebSocketServer/withFirmata.js:2:13)

Which points to the one-before-last line in:

let

    /* istanbul ignore next */
    if (parseFloat(process.versions.nw) >= 0.13) {
      serialport = require("browser-serialport");
    } else {
      serialport = require("serialport");
    }

    // console.log(require);
    // Request a list of available ports, from
    // the result set, filter for valid paths
    // via known path pattern match.
    serialport.list().then(results => {
      const portPaths = results.reduce((accum, result) => {

npm list gives me:

├── [email protected] ├── [email protected] └── [email protected]

Anyone an idea how to solve this?

Kind regards, Manno