thiagoelg / node-printer

Native node.js printer
125 stars 76 forks source link

Different Node.js version error during complitation [Electron - 8.0.1] #10

Closed digember29 closed 4 years ago

digember29 commented 4 years ago

Hello, My Node.js version is 10.19 (stable) when I installed this fork it worked without any error. But when i run npm run dev - it shows error The module 'path/node_modules/@thiagoelg/node-printer/lib/node_printer.node' [1] was compiled against a different Node.js version using [1] NODE_MODULE_VERSION 76. This version of Node.js requires [1] NODE_MODULE_VERSION 70. Please try re-compiling or re-installing.

I have tried electron-rebuild way but still the error is there. Please help me fix this error. There's not much information on the doc.

HuangFuQuang commented 4 years ago

I have the same question

digember29 commented 4 years ago

I have resolved the issue. Its because of the electron uses its own version of Node.js. Initially I tried upgrading my Node.js to v12 and electron to the version wihich matches to chromium version, but issue was not fixed..

What i did to resolve the issue - install electron rebuild - npm install --save-dev electron-rebuild then remove node_modules and package-lock.json

After that do npm install, and immediately after npm install run - ./node_modules/.bin/electron-rebuild It downgraded my electron version to 5.0.13 and compilation error gone... Hope it will resolve your issue