Skip to content

TypeError: serialport is not a constructor #77

Description

@papavictorromeo

Hi,

Trying to create a simple Modbus program on a Linux system.

var modbus = require("modbus-stream");

modbus.serial.connect("/dev/ttyUSB0", { baudRate: 19200, parity: "even", dataBits: 8, stopBits: 1, debug: "automaton-123" }, (err, connection) => {
if (err) throw err;

connection.readHoldingRegisters({ address: 0x5b00, quantity: 8, extra: { unitId: 1 } }, (err, res) => {
    if (err) throw err;

    console.log(res); // response
})

});

And get the error in de title. Any ideas?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions