Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

node-escpos prints twice

Open
#370 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
40/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, nodejs
Domain
embedded-iot

Research direction

Start with index.js and the device.open callback shown in the report, then run node index.js while observing the callback log and printer output. Trace why the callback is entered twice and verify that the callback and text are each processed only once.

Written by the indexing model from the issue text.

Description

I have the following code

const escpos = require('escpos');
escpos.USB = require('escpos-usb');
const device  = new escpos.USB(2727, 772);
const options = { encoding: "ISO8859-15" /* default */ }
const printer = new escpos.Printer(device, options);
device.open(function(error){
  console.log("internal call")
  printer
  .text("Test123 This is a happy printer doing it's job twice. Too happy?")
  .close()
});

when I run the code with
$node index.js

the thermal printer will print the text twice. I have also tried to add the cut() flush() method within the open callback method. I can see that this callback method is called two times, as in the console it prints "internal call" twice.

Expected: the printer only prints the text once.

Thanks for the help

Dominant language
TypeScript
Stars
1.6k
Forks
443
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lsongdev/node-escpos

All issues in lsongdev/node-escpos

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.