node-escpos icon indicating copy to clipboard operation
node-escpos copied to clipboard

Error in escpos-usb line 52 usb.on() not working

Open jmrg-link opened this issue 3 years ago • 4 comments

Error line usb.on comment line . Printer not init . escpos-usb -> index line comments /* usb.on('detach', function(device){ if(device == self.device) { self.emit('detach' , device); self.emit('disconnect', device); self.device = null; } }); */

jmrg-link avatar Oct 04 '22 11:10 jmrg-link

I think the issue is being caused by the utils.inherit() which is deprecated. I fixed this by copying all the code in the escpos-usb module into a file, commenting out that part, then requiring that file instead.

XavierTM avatar Oct 25 '22 13:10 XavierTM

this is because escpos-usb has a wildcard dependency on usb, which means it's pulling in versions with breaking changes it's not compatible with. with recent versions of npm you can fix this by adding a version override for usb to your package.json:

  "overrides": {
    "usb": "1.8.8"
  }

apaleslimghost avatar Dec 31 '22 16:12 apaleslimghost

you can try : usb.usb.on ...

wxuefei avatar Apr 08 '23 09:04 wxuefei

Was the same problem. @apaleslimghost solution helps.

denkol avatar Oct 05 '23 22:10 denkol