node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

SerialPort.list is not a function

Open iamisti opened this issue 3 years ago • 3 comments

SerialPort Version

10.5.0

Node Version

14.16

Electron Version

12.0.4

Platform

Microsoft Windows NT 10.0.22621.0 x64

Architecture

x64

Hardware or chipset of serialport

No response

What steps will reproduce the bug?

Just run the specified node version and you will get the issue (i guess)

What happens?

When running the code const board = new Board(); I get an error.

The error is the following (HardwareDevicesService.ts is my file):

board.js:42 Uncaught TypeError: serialport.list is not a function
    at Board.detect (board.js:42)
    at new Board (board.js:291)
    at addBoard (HardwareDevicesService.ts:24)

What should have happened?

run without errors

Additional information

I'm using electron-forge but I dont think that matters.

iamisti avatar Nov 27 '22 16:11 iamisti

Hi, not sure if this help but maybe you are importing SerialPort incorrectly (mind curly bracers :) ). Have a look at this example https://github.com/serialport/electron-serialport/blob/6cf4e28ec9df4d45e73d2ceca1e6e131af588956/renderer.js

Edited: @iamisti or check this thread: https://stackoverflow.com/a/63370876/2893810 It looks like it (list) has been moved

miroslawlis avatar Feb 10 '23 21:02 miroslawlis

Hi @iamisti are you still experiencing this issue?

GazHank avatar Jun 22 '23 11:06 GazHank

@iamisti Are you sure you are calling .list() on a class itself not on an instance of a class?

yangit avatar Apr 19 '24 05:04 yangit