thiagoelg / node-printer

Native node.js printer
132 stars 79 forks source link

Error: Module did not self-register #64

Closed ananthdp closed 1 year ago

ananthdp commented 1 year ago

Error: Module did not self-register: '/Users/vananth/Desktop/Work/New-UI/dot-pos-nw/node_modules/@thiagoelg/node-printer/lib/node_printer.node'. at Module._extensions..node (node:internal/modules/cjs/loader:1278:18) at Module.load (node:internal/modules/cjs/loader:1051:32) at Module._load (node:internal/modules/cjs/loader:892:12) at Module.require (node:internal/modules/cjs/loader:1075:19) at require (node:internal/modules/cjs/helpers:98:18) at Object. (/Users/vananth/Desktop/Work/New-UI/dot-pos-nw/node_modules/@thiagoelg/node-printer/lib/printer.js:10:22) at Module._compile (node:internal/modules/cjs/loader:1173:14) at Module._extensions..js (node:internal/modules/cjs/loader:1233:10) at Module.load (node:internal/modules/cjs/loader:1051:32) at Module._load (node:internal/modules/cjs/loader:892:12)

ananthdp commented 1 year ago

This problem is mentioned at many places, but I couldn't find a constructive solution.

joaodematejr commented 1 year ago

Same problem

ananthdp commented 1 year ago

Worked on matching the nw node version to my system node version via nvm.

joaodematejr commented 1 year ago

Worked on matching the nw node version to my system node version via nvm.

which version are you using?

ananthdp commented 1 year ago

I was using nwjs 0.70.0 so internally it uses node v18.10.0, use the same via nvm, you're good to go.

hiveSAYSi commented 1 year ago

Ack I am dealing with this too. I tried installing older versions of node and it doesn't seem to have fixed it....

hiveSAYSi commented 1 year ago

Like, it no longer reports module not self registering, but it now refuses to print with an unspecified error, probably out of node-thermal-printer ¬¬

joserick commented 1 year ago

Solution:

songjingwei commented 2 months ago

Solution:

  • npm i @electron/rebuild
  • .\node_modules.bin\electron-rebuild

Thank you, sir!