Klemen1337 / node-thermal-printer

Node.js module for Epson, Star, Tanca, Drauma and Brother thermal printers command line printing.
MIT License
765 stars 244 forks source link

ReferenceError: waitForResponse is not defined #255

Closed DeanHarber closed 1 month ago

DeanHarber commented 3 months ago

When trying to print via printer.raw I get the following error:

ReferenceError: waitForResponse is not defined
    at Network.execute (/home/dean/pos/print-runner/node_modules/node-thermal-printer/lib/interfaces/network.js:41:37)
    at ThermalPrinter.raw (/home/dean/pos/print-runner/node_modules/node-thermal-printer/lib/core.js:452:35)
    at file:///home/dean/pos/print-runner/test.js:35:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I'm not sure why no-one else has mentioned this issue. Thinking it might be due to different transpilation.

In node-thermal-printer/lib/interfaces/network.js

async execute(buffer, options = { waitForResponse }) {
    return new Promise((resolve, reject) => {
      const name = `${this.host}:${this.port}`;
      const networkConnection = Net.connect(

Above wiatForResponse is not defined anywhere in file. I take it that means it should result in undefined / falsey, but for me it just errors.

Setting it to { waitForResponse: false } fixes the error.

Made a fork for my needs

Klemen1337 commented 1 month ago

Fixed