thiagoelg / node-printer

Native node.js printer
125 stars 76 forks source link

Can you build a prebuild version for electron9 #15

Closed scofieldpeng closed 3 years ago

scofieldpeng commented 3 years ago

Hi, i see you create a pr to source repo for electron9 and node 12, can you create a tag for your own repo for prebuild release? Thanks a million:-)

thiagoelg commented 3 years ago

Hello! We use prebuild to generate builds and releases, but unfortunately it hasn't been updated to build for Electron 9 (it kind of builds, but it targets v80 instead of v83, for some reason).

You can build it locally if you want, you can see the commands on the scripts here (buildElectronLinux.sh) for Linux, and here (buildElectronWindows.ps1) for Windows. Just be sure to have node-pre-gyp and python installed (on Linux you may need to install libcups2-dev via apt or whatever package manager you use).

scofieldpeng commented 3 years ago

thanks for million, I have downgraded my electron version to 8

TimoKunze commented 3 years ago

I can use node-printer with electron 9.2.1 if I run npm upgrade node-abi --depth=10 followed by electron-rebuild.

TimoKunze commented 3 years ago

I can use node-printer with electron 9.2.1 if I run npm upgrade node-abi --depth=10 followed by electron-rebuild.

Hmm, the only problem I noticed is that on some machines this for some reason builds a 32 bit node module (node_printer.node) instead of a 64 bit one. I have not yet found out why this happens.

/Edit: Okay, as it turned out those machines unexpectedly have been running a 32 bit version of nodejs.

falahati commented 3 years ago

@TimoKunze solution works great with the latest version of the Electron at the time (10.1.5), but since I was using the library in the renderer process, I had to set the app.allowRendererProcessReuse to false. Apparently, this should be fixed here since the library is not "context aware". Meanwhile, I don't really have more than one window/renderer process for my app and this isn't an issue. Unless they decide to remove the flag at some time in the future.

TimoKunze commented 3 years ago

@falahati Electron 11 seems to be the last release that supports such libraries. I hope this library gets updated until then. I don't know how to do it, otherwise I would try to create a patch.

TimoKunze commented 3 years ago

@falahati Have you already tested this package with Electron 11? Does it still work?

falahati commented 3 years ago

I am still on 10 so I don't really know.

TimoKunze commented 3 years ago

At least for my use case it still works in Electron 11. However, I have other issues with Electron 11, so I'll go back to 10. I also did try with Electron 12 Beta 24 and it still works. But it might be because I don't use the library from the renderer process.

thiagoelg commented 3 years ago

Hi everyone! I finally got some time to work a little in this library, and based on the work of @ivannkf I managed to make prebuilds go up to Electron 13 and Node 16! You can check them on the 0.5.5 release.

I didn't get to test all these versions, so I'm not sure they're working as intended, but let me know if you find any problems.