Closed philipptrenz closed 3 years ago
Bump - I have this problem too and if that is all it takes to fix, @philipptrenz could you submit a PR with that change?
I had no chance to test if it has any runtime issues, I can only say that it compiles. I'm also not sure if there are any other side effects
Well I'm also able to get it compiled on 12.13.0 but I don't have a printer and the package doesn't show any in the getPrinters()
list so...100% working fine :grin:
I've faced the same issue too with Electron v7 and Electron v8.
This change solves the issue with Electron v8 (node 12.13.0
).
I was sure that it will break compatibility with Electron v6 (node 12.4.0
), but it does not change it.
For those, who want a quick fix:
postinstall
patches/printer+0.4.0.patch
:diff --git a/node_modules/printer/src/macros.hh b/node_modules/printer/src/macros.hh
index 1ae5c0c..cd082c8 100644
--- a/node_modules/printer/src/macros.hh
+++ b/node_modules/printer/src/macros.hh
@@ -4,7 +4,7 @@
#include <nan.h>
#include <node_version.h>
-#if NODE_VERSION_AT_LEAST(13, 0, 0)
+#if NODE_VERSION_AT_LEAST(12, 0, 0)
# define MY_NODE_GET_OBJECT(object, id) object->Get(v8::Isolate::GetCurrent()->GetCurrentContext(), id).ToLocalChecked()
# define MY_NODE_SET_OBJECT(object, id, prop) object->Set(v8::Isolate::GetCurrent()->GetCurrentContext(), id, prop)
# define MY_NODE_SET_OBJECT_PROP(object, id, prop) MY_NODE_SET_OBJECT(object, V8_STRING_NEW_UTF8(id), prop)
npm install
againAbout the test with the real printer: I can do it tomorrow. If everything works and I will be able to get printer details and print a photo, I will do a PR to this project.
I confirm that it change works on Mac OS 10.13 and Lubuntu 18.04 in an Electron v8.2.5 application to list printers and print a photo.
Of course, I can create a PR, but I'm unsure about this change. I'm not sure how it can affect users of the lib on different environments and NodeJS versions.
The PR is created
Awesome :)
The PR is created
I do not see the change that is supposed to change after PR. is it done ?
Yep, it is done.
#if NODE_VERSION_AT_LEAST(13, 0, 0)
has been replaced with #if NODE_VERSION_AT_LEAST(12, 0, 0)
on line number 7.
Hey there, I'm about to build printer on X64 with Node v12 and yarn against Electron 8.2.0 by help of electron-rebuild, but the process fails with the following error message:
I'm not really sure what I'm doing and I also had not yet the chance to test it, but by changing line 7 in
src/macro.hh
fromto
it builds fine.
Any suggestions?