node-native-printer
node-native-printer copied to clipboard
Fails to compile on macOS 10.14.6 with errors
Description of the problem The package fails to compile during installation and produces errors. The errors seem to be these:
../lib/unix/API.cpp:36:38: error: no matching member function for call to 'ToString'
String::Utf8Value printer(args[0]->ToString());
~~~~~~~~~^~~~~~~~
../lib/unix/API.cpp:167:47: error: no matching member function for call to 'ToString'
string printer(*(String::Utf8Value(args[0]->ToString())));
~~~~~~~~~^~~~~~~~
../lib/unix/API.cpp:168:44: error: no matching member function for call to 'ToString'
string file(*(String::Utf8Value(args[1]->ToString())));
~~~~~~~~~^~~~~~~~
../lib/unix/API.cpp:169:47: error: no matching member function for call to 'ToString'
string options(*(String::Utf8Value(args[2]->ToString())));
~~~~~~~~~^~~~~~~~
The entire log output including warnings and notes is here: https://gist.github.com/douira/066a8bb4cd9781434a0242c09a927b3b
To Reproduce
npm install --save node-native-printer
OS macOS 10.14.6 (latest at the time) I have XCode 10.3 (10G8) and GNU Make 3.81 installed. (latest at the time) Running Node.js 12.8.0
I did some research and it seems this is caused by deprecation and removal of certain features in V8. I don't know C++ so I can't really provide a fix for this sadly. You might also want to look into using N-API instead of V8 so you don't need to update with new node versions but I don't know if that interferes with the printing communication. I found more info and fixes here that use Nan: https://github.com/RuntimeTools/appmetrics/pull/576
@douira @MatteoMeil, same problem here. (macOS 10.15.6) It's related to node version (on macos), using [email protected] it builds successfully, on the other hand the rest of my project can't work on node 8.
Switching to node 10 (or 12) brings back the API.cpp build problem....
`
node install/install.js
../lib/unix/API.cpp:17:13: error: no matching member function for call to 'Set'
printer->Set(UTF8_STRING("name"), UTF8_STRING(dests[i].name));
~~~~~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:18:13: error: no matching member function for call to 'Set'
printer->Set(UTF8_STRING("default"), Boolean::New(isolate, static_cast<bool>(dests[i].is_default)));
~~~~~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:20:14: error: no matching member function for call to 'Set'
printers->Set(i, printer);
~~~~~~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:32:4: error: no viable conversion from 'MaybeLocal<v8::String>' to 'Local<v8::String>'
THROW_EXCEPTION("Too few arguments");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/unix/API.hpp:9:80: note: expanded from macro 'THROW_EXCEPTION'
#define THROW_EXCEPTION(msg) isolate->ThrowException(v8::Exception::TypeError(String::NewFromUtf8(isolate, msg)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:186:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'MaybeLocal<v8::String>' to 'const v8::Local<v8::String> &' for 1st argument
class Local {
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:186:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'MaybeLocal<v8::String>' to 'v8::Local<v8::String> &&' for 1st argument
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:190:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local<S> that)
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:7189:47: note: passing argument to parameter 'message' here
static Local<Value> TypeError(Local<String> message);
^
../lib/unix/API.cpp:36:47: error: too few arguments to function call, single argument 'context' was not specified
String::Utf8Value printer(args[0]->ToString());
~~~~~~~~~~~~~~~~~ ^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:2804:3: note: 'ToString' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8config.h:429:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
^
../lib/unix/API.cpp:41:4: error: no viable conversion from 'MaybeLocal<v8::String>' to 'Local<v8::String>'
THROW_EXCEPTION("Printer not found or error retrieving printer");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lib/unix/API.hpp:9:80: note: expanded from macro 'THROW_EXCEPTION'
#define THROW_EXCEPTION(msg) isolate->ThrowException(v8::Exception::TypeError(String::NewFromUtf8(isolate, msg)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:186:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'MaybeLocal<v8::String>' to 'const v8::Local<v8::String> &' for 1st argument
class Local {
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:186:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'MaybeLocal<v8::String>' to 'v8::Local<v8::String> &&' for 1st argument
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:190:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local<S> that)
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:7189:47: note: passing argument to parameter 'message' here
static Local<Value> TypeError(Local<String> message);
^
../lib/unix/API.cpp:53:17: error: no matching member function for call to 'Set'
CUPSOptions->Set(UTF8_STRING(dest->options[i].name), UTF8_STRING(dest->options[i].value));
~~~~~~~~~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:65:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("completed_time"), UTF8_STRING(httpGetDateString(printerJobs[i].completed_time)));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:66:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("creation_time"), UTF8_STRING(httpGetDateString(printerJobs[i].creation_time)));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:67:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("format"), UTF8_STRING(printerJobs[i].format));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:68:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("id"), UTF8_STRING(id));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:69:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("priority"), UTF8_STRING(priority));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:70:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("processing_time"), UTF8_STRING(httpGetDateString(printerJobs[i].processing_time)));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:71:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("size"), UTF8_STRING(size));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:72:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("status"), UTF8_STRING(getJobStatusString(printerJobs[i].state)));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:73:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("title"), UTF8_STRING(printerJobs[i].title));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:74:9: error: no matching member function for call to 'Set'
job->Set(UTF8_STRING("user"), UTF8_STRING(printerJobs[i].user));
~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:76:10: error: no matching member function for call to 'Set'
jobs->Set(i, job);
~~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../lib/unix/API.cpp:82:11: error: no matching member function for call to 'Set'
result->Set(UTF8_STRING("jobs"), jobs);
~~~~~~~~^~~
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3664:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/XXX/.electron-gyp/9.1.1/include/node/v8.h:3667:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [Release/obj.target/unix_printer/lib/unix/API.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/XXX/Documents/Progetti/test/node_modules/node-native-printer
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/XXX/.npm/_logs/2020-07-31T12_54_17_958Z-debug.log
Installation aborted.`