lsongdev / node-escpos

🖨️ ESC/POS Printer driver for Node.js
https://npmjs.org/escpos
Other
1.38k stars 423 forks source link

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

Open jmrg-link opened 2 years ago

jmrg-link commented 2 years ago

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; } }); /

XavierTM commented 2 years ago

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.

apaleslimghost commented 1 year ago

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"
  }
wxuefei commented 1 year ago

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

denkol commented 1 year ago

Was the same problem. @apaleslimghost solution helps.

Zetjen commented 2 weeks ago

Fixed on #429