TypeError: Cannot read properties of undefined
sksar opened this issue · 1 comments
sksar commented
TypeError: Cannot read properties of undefined (reading 'font')
at Printer.barcode (/Users/sks/Desktop/My-Projects/printy/node_modules/@node-escpos/core/dist/index.cjs:887:28)
at /Users/sks/Desktop/My-Projects/printy/print.js:24:10
at Interface.<anonymous> (/Users/sks/Desktop/My-Projects/printy/node_modules/@node-escpos/usb-adapter/dist/index.cjs:93:27)
at Device.<anonymous> (/Users/sks/Desktop/My-Projects/printy/node_modules/usb/dist/usb/interface.js:117:26)
This is the error I get, when I am executing the following code:
const { Printer } = require('@node-escpos/core');
const USB = require("@node-escpos/usb-adapter");
const device = new USB(1110, 2056);
device.open(function(err) {
if(err) {
console.log(err);
return;
}
const printer = new Printer(device, {});
console.log(printer);
printer
.font('a')
.style('bu')
.align('ct')
.size(0, 0)
.barcode('123456789111', 'EAN13')
.size(0, 0)
.text("")
printer.cut().close().then(r => console.log(r));
})
The original library song940/node-escpos
works, but this library gives me this error. I have been at this for two days. Can't seem to figure out why.
sksar commented
Okay, I think the issue is in the barcode line, it needs a 3rd parameter, even if it's an empty object.