Node JS serialport@6.0.0打开端口并自动关闭它

Node JS serialport@6.0.0 Opening port and closing it automatically

I'm using Node JS SerialPort@6.0.0 Package for connecting to computer ports.

I wrote this code to get the arduino-uno data:

const SerialPort = require('serialport');
const port = new SerialPort('COM4',{
    baudRate: 9600
});

port.on('open', function(){
    console.log("port open");
    port.on('data', function(data){
        console.log("Data:" + data);
    })
})

When it starts it automatically stops in sequence. I already used a err handler but no error was shown. And when im using serialport@4.0.0 it works flawless.

Console