Nodejs Error "SerialPort is not a function...." with node-serialport-omega2

  • Re: Serial port communication using Node.js

    @Steven-de-Salas Hello I am having some trouble getting the node-serialport-omega2 module to function.

    To isolate the problem I have factory reset my Omega and only installed Nodejs and NPM.

    I downloaded the node_modules from the above link

    and SCP'd those files to the Omega.

    Then checked it with npm ls, which reports several missing dependencies. I installed all depenencies until npm ls reports no errors ( Except for a version conflict with debug, however the error states that the serialport module will still load. )

    I have a very minimal script.

    var SerialPort = require('serialport');
    var port = new SerialPort('/dev/ttyS0',
                            parser: SerialPort.parsers.readline('\n'),
                            baudRate: 115200

    when I run the script I get the following error.

    var port = new SerialPort('/dev/ttyS0',
    TypeError: SerialPort is not a function

    If it will be of interest or help I can post my full npm ls here.

    Thank you in advance for your help.

Log in to reply

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.