Skip to content

SerialPort 9x -> 10.x problem #19

@VincentSC

Description

@VincentSC

Hi Sebastian,

Long time not "spoken"! :)

I got a problem since some time, and I did not realize till today it was in this package caused by 3460ba4

node-red-contrib-comfoair gives these errors:

9 Apr 20:53:08 - [error] [comfoair:c5f08486.64a36] TypeError: SerialPort is not a constructor
9 Apr 20:53:08 - [error] [comfoair:f912a0a0.e8fe98] TypeError: SerialPort is not a constructor
9 Apr 20:53:08 - [error] [comfoair:d1308d38.3511f] TypeError: SerialPort is not a constructor

Eventually I got here: https://serialport.io/docs/guide-upgrade#upgrading-from-9x-to-10x

Everywhere this needs to change:
const SerialPort = require('serialport'); -> const { SerialPort } = require('serialport');.

  • node-red-contrib-comfoair/comfoair-connection.js
  • comfoair/ComfoairStream.js
        this.port = new SerialPort(options.port, {
            baudRate: options.baud || 9600
        }, cb);

has to change to

        this.port = new SerialPort({ 
            path: options.port,
            baudRate: options.baud || 9600
        }, cb);

I tested successfully with both downgrading back to serialport 9.2.8 and the above fixes with 10.5.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions