How to read data from ML Using modbus-serial function code

Hi there, i have an example of modbus-serial and i installed it via npm install modbus-serial
and i got an example but this example has some error which i am not getting it how to solve so can anyone check what is the issue and why the error are coming.

var modbus = require('modbus-serial');

var client = new modbus.client.RTU(
    '/dev/ttyUSB0', // Replace this with the path to your serial port
    {
        baudRate: 9600,
        dataBits: 8,
        stopBits: 1,
        parity: 'even'
    }
);

client.writeHoldingRegisters(40010, [1]) // Write the value 1 to address 40010
    .then(function() {
        console.log('Success');
    })
    .catch(function(err) {
        console.error(err);
    });

There are modbus nodes you can install from the palette - no need for DIY code

Why can't you help with this, this is also an example from modbus-serial

Why don't you want to use the modbus nodes?
Why do you want to hand code this?

I don't know how to use modbus for rs232 serial communication can you please give me some examples of it

Search the forum. Modbus is heavily discussed here.

As for examples node-red-contrib-modbus has built-in examples (use Ctrl-i in the node-red editor to access built-in examples