Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

755
Views
NodeJS 'Readline' is not a constructor

I'm having issues with my NodeJS app. It's supposed to be a NodeJS server to serial port, but I'm having issues with Readline and it used to throw errors about SerialPort too. If anyone can recommend how to syntax check code on node.

The error:

TypeError: readline is not a constructor
at Object.<anonymous> (/x/server.js:17:11)

The code:

const myPort = new SerialPort({
  path:portname,
  baudRate:9600,
  parser: new readline("\n")
}); 
const SerialPort = require('serialport');
const readline = require("readline");
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I don't know what you wanted to achieve this way, but you could try:

const myPort = new SerialPort({
  path:portname,
  baudRate:9600,
  parser: readline
}); 

Now you can use readline as a myPort.parser.

If you want to know more about readline, check this out: https://www.geeksforgeeks.org/node-js-readline-module/

about 4 years ago · Juan Pablo Isaza Report

0

Try this with Capital letter

const SerialPort = require('serialport');
const {Readline} = require("readline");

const myPort = new SerialPort({
  path:portname,
  baudRate:9600,
  parser: new Readline("\n")
}); 

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!