Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

node-escpos prints twice

オープン
#370 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
40/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, nodejs
領域
embedded-iot

調査の方向性

index.js と、レポートに示されている device.open コールバックから始め、コールバックのログとプリンターの出力を観察しながら node index.js を実行します。コールバックが 2 回呼び出される理由を追跡し、コールバックとテキストがそれぞれ 1 回だけ処理されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
TypeScript
スター
1.6k
フォーク
443
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lsongdev/node-escpos のほかの issue

lsongdev/node-escpos の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。