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

Error when rebuilding with electron-rebuild.cmd

Open MY020537 opened this issue 5 years ago • 9 comments

Recently i upgraded electron application with Node version 12.13.0 and Electron 8.0.0. Printer module started causing issues once again :(
Found out to run electron-rebuild.cmd. but getting list of issues like

**node_printer_win.cc(622): error C2661: 'v8::Object::Set': no overloaded function takes 2 arguments**

Is it because of Node version ? How can i fix this ? Kindly help

MY020537 avatar Feb 20 '20 04:02 MY020537

Same problem. I'm running the following dependencies:

"dependencies": { "printer": "^0.4.0", }, "devDependencies": { "electron": "^8.0.1", "electron-rebuild": "^1.10.0" }

After using --build-from-source I get the following error:

\node_modules\printer\lib\node_printer.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 72. This version of Node.js requires NODE_MODULE_VERSION 76. Please try re-compiling or re-installing the module (for instance, using npm rebuildornpm install).

I tried to resolve this with using electron-rebuild, but sadly I get compile errors as described from @MY020537

fayeinmay avatar Feb 20 '20 07:02 fayeinmay

Just FYI, when going down some major electron versions, namely to version 6.1.7 and then running node-gyp.cmd rebuild --target=6.1.7 --arch=x64 --dist-url=https://electronjs.org/headers in node_modules/printer you can get it running though. @MY020537

fayeinmay avatar Feb 20 '20 07:02 fayeinmay

@JanDevDE Yeah i thought of downgrading But with that version of electron, they have got known bugs with webContents.print() api. and i need that too considering my requirements. so can not choose that version either.

MY020537 avatar Feb 20 '20 07:02 MY020537

@JanDevDE - Which node version you are using with electron 6.1.7 ?

MY020537 avatar Feb 20 '20 08:02 MY020537

Same problem. I came to the same conclusion and downgrade with success to electron v6.1.7, which uses NodeJS v12.4.0 (process.version from inside electron). If I understand correctly, electron comes with its own NodeJS version, thus the need to launch electron-rebuild.

edit: "Chromium and Node.js both depend on V8, and Electron contains only a single copy of V8" https://www.electronjs.org/docs/development/upgrading-node List of electron release with associated NodeJS and Chromium versions: https://github.com/electron/releases

xsenechal avatar Feb 20 '20 10:02 xsenechal

@MY020537 Ah, okay. I'm using v12.16.1, but that doesn't really matter IIRC.

fayeinmay avatar Feb 20 '20 12:02 fayeinmay

same issue here.

Probably, we can change the "msvs_version": to 2013?

xuehaoze avatar Feb 20 '20 23:02 xuehaoze

tried vs 2013, seems doesn't work.

And confirmed that the error gone after I downgraded the Electron version from v7.1.12 to v6.1.7.

xuehaoze avatar Feb 21 '20 17:02 xuehaoze

I have thwe same problem and only downgrading worked for me. I would appreciate fixing this issue on an upcoming update.

angjelonuho avatar Dec 19 '20 20:12 angjelonuho