stream icon indicating copy to clipboard operation
stream copied to clipboard

TypeError: serialport is not a constructor

Open papavictorromeo opened this issue 3 years ago • 1 comments

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?

papavictorromeo avatar Feb 28 '23 07:02 papavictorromeo

Having the same issue. Where you ever able to resolve this, @papavictorromeo?

NordicBreezeStudios avatar Apr 08 '25 07:04 NordicBreezeStudios