TypeError: SerialPort is not a constructor
SerialPort Version
10.4.0
Node Version
16.14.2
Electron Version
No response
Platform
Win10
Architecture
x64
Hardware or chipset of serialport
No response
What steps will reproduce the bug?
const express = require('express'); const app = express(); const chalk = require('Chalk'); const SerialPort = require("serialport"); const SerialPortStream = require ('@serialport/stream');
const port = 3000;
const arduinoCOMPort = "COM3";
const arduinoSerialPort = new SerialPort(arduinoCOMPort, { baudrate: 9600 });
arduinoSerialPort.on('open', function() { console.log(chalk.white("[") + chalk.green('+') + chalk.white("]") + 'Serial Port') })
What happens?
C:\Users\callum.burns\Documents\GitHub\projet-Panneau-Solaire\calcul\master.ts:11 ^
TypeError: SerialPort is not a constructor
at Object.
NOTE: does not work in either .js or .ts files.
What should have happened?
Should have made the constructor
Additional information
NOTE: does not work in either .js or .ts files.
See our upgrade guide. You're using v9 apis
https://serialport.io/docs/guide-upgrade