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

Installation fails with "cannot convert ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’"

Open centic9 opened this issue 9 months ago • 0 comments

When I try to install a project which has a transitive dependency on "microtime", it fails with an error about "cannot convert ‘v8::Localv8::Context’ to ‘v8::Isolate*’"

Happens on the following environments

  • Ubuntu 22.02, Node v16.20.2
  • Current Debian Testing, Node v18.18.2
± npm install
npm ERR! code 1
npm ERR! path /tmp/map-tiles-proxy/node_modules/microtime
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Verzeichnis „/tmp/map-tiles-proxy/node_modules/microtime/build“ wird betreten
npm ERR!   CXX(target) Release/obj.target/microtime/src/microtime.o
npm ERR! make: Verzeichnis „/tmp/map-tiles-proxy/node_modules/microtime/build“ wird verlassen
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.11.6 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/tmp/map-tiles-proxy/node_modules/microtime/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/user/.cache/node-gyp/18.18.2/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/user/.cache/node-gyp/18.18.2',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/user/.cache/node-gyp/18.18.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/tmp/map-tiles-proxy/node_modules/microtime',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../../nan/nan_converters.h:67,
npm ERR!                  from ../../nan/nan.h:222,
npm ERR!                  from ../src/microtime.cc:9:
npm ERR! ../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ToFactoryBase<v8::Boolean>::return_t Nan::imp::ToFactory<v8::Boolean>::convert(v8::Local<v8::Value>)’:
npm ERR! ../../nan/nan_converters_43_inl.h:18:49: error: cannot convert ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
npm ERR!    18 |       val->To ## TYPE(isolate->GetCurrentContext())                            \
npm ERR!       |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
npm ERR!       |                                                 |
npm ERR!       |                                                 v8::Local<v8::Context>
npm ERR! ../../nan/nan_converters_43_inl.h:22:1: note: in expansion of macro ‘X’
npm ERR!    22 | X(Boolean)
npm ERR!       | ^
npm ERR! In file included from /home/user/.cache/node-gyp/18.18.2/include/node/v8-primitive.h:11,
npm ERR!                  from /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:11,
npm ERR!                  from /home/user/.cache/node-gyp/18.18.2/include/node/v8-array-buffer.h:13,
npm ERR!                  from /home/user/.cache/node-gyp/18.18.2/include/node/v8.h:24,
npm ERR!                  from /home/user/.cache/node-gyp/18.18.2/include/node/node.h:73,
npm ERR!                  from ../../nan/nan.h:53:
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-value.h:398:37: note:   initializing argument 1 of ‘v8::Local<v8::Boolean> v8::Value::ToBoolean(v8::Isolate*) const’
npm ERR!   398 |   Local<Boolean> ToBoolean(Isolate* isolate) const;
npm ERR!       |                            ~~~~~~~~~^~~~~~~
npm ERR! ../../nan/nan_converters_43_inl.h: In static member function ‘static Nan::imp::ValueFactoryBase<bool>::return_t Nan::imp::ToFactory<bool>::convert(v8::Local<v8::Value>)’:
npm ERR! ../../nan/nan_converters_43_inl.h:37:55: error: cannot convert ‘v8::Local<v8::Context>’ to ‘v8::Isolate*’
npm ERR!    37 |   return val->NAME ## Value(isolate->GetCurrentContext());                     \
npm ERR!       |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
npm ERR!       |                                                       |
npm ERR!       |                                                       v8::Local<v8::Context>
npm ERR! ../../nan/nan_converters_43_inl.h:40:1: note: in expansion of macro ‘X’
npm ERR!    40 | X(bool, Boolean)
npm ERR!       | ^
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-value.h:408:30: note:   initializing argument 1 of ‘bool v8::Value::BooleanValue(v8::Isolate*) const’
npm ERR!   408 |   bool BooleanValue(Isolate* isolate) const;
npm ERR!       |                     ~~~~~~~~~^~~~~~~
npm ERR! In file included from ../../nan/nan_new.h:189,
npm ERR!                  from ../../nan/nan.h:223:
npm ERR! ../../nan/nan_implementation_12_inl.h: In static member function ‘static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)’:
npm ERR! ../../nan/nan_implementation_12_inl.h:356:31: error: no matching function for call to ‘v8::StringObject::New(v8::Local<v8::String>&)’
npm ERR!   356 |   return v8::StringObject::New(value).As<v8::StringObject>();
npm ERR!       |          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
npm ERR! In file included from /home/user/.cache/node-gyp/18.18.2/include/node/v8.h:47:
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-primitive-object.h:81:23: note: candidate: ‘static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)’
npm ERR!    81 |   static Local<Value> New(Isolate* isolate, Local<String> value);
npm ERR!       |                       ^~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-primitive-object.h:81:23: note:   candidate expects 2 arguments, 1 provided
npm ERR! ../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before ‘>’ token
npm ERR!   356 |   return v8::StringObject::New(value).As<v8::StringObject>();
npm ERR!       |                                                          ^
npm ERR! ../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ‘)’ token
npm ERR!   356 |   return v8::StringObject::New(value).As<v8::StringObject>();
npm ERR!       |                                                            ^
npm ERR! ../../nan/nan.h: In function ‘void Nan::AsyncQueueWorker(AsyncWorker*)’:
npm ERR! ../../nan/nan.h:2232:7: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
npm ERR!  2232 |     , reinterpret_cast<uv_after_work_cb>(AsyncExecuteComplete)
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../../nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, GetterCallback, SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, imp::Sig)’:
npm ERR! ../../nan/nan.h:2470:19: warning: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, v8::Local<v8::AccessorSignature>, v8::SideEffectType, v8::SideEffectType)’ is deprecated: Do signature check in accessor [-Wdeprecated-declarations]
npm ERR!  2470 |   tpl->SetAccessor(
npm ERR!       |   ~~~~~~~~~~~~~~~~^
npm ERR!  2471 |       name
npm ERR!       |       ~~~~
npm ERR!  2472 |     , getter_
npm ERR!       |     ~~~~~~~~~
npm ERR!  2473 |     , setter_
npm ERR!       |     ~~~~~~~~~
npm ERR!  2474 |     , obj
npm ERR!       |     ~~~~~
npm ERR!  2475 |     , settings
npm ERR!       |     ~~~~~~~~~~
npm ERR!  2476 |     , attribute
npm ERR!       |     ~~~~~~~~~~~
npm ERR!  2477 |     , signature);
npm ERR!       |     ~~~~~~~~~~~~
npm ERR! In file included from /home/user/.cache/node-gyp/18.18.2/include/node/v8-function.h:15,
npm ERR!                  from /home/user/.cache/node-gyp/18.18.2/include/node/v8.h:33:
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-template.h:838:8: note: declared here
npm ERR!   838 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! In file included from /usr/include/c++/13/cassert:44,
npm ERR!                  from /home/user/.cache/node-gyp/18.18.2/include/node/node_object_wrap.h:26,
npm ERR!                  from ../../nan/nan.h:55:
npm ERR! ../../nan/nan_object_wrap.h: In destructor ‘virtual Nan::ObjectWrap::~ObjectWrap()’:
npm ERR! ../../nan/nan_object_wrap.h:24:25: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
npm ERR!    24 |     assert(persistent().IsNearDeath());
npm ERR!       |                         ^~~~~~~~~~~
npm ERR! ../../nan/nan_object_wrap.h: In static member function ‘static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’:
npm ERR! ../../nan/nan_object_wrap.h:127:26: error: ‘class Nan::Persistent<v8::Object>’ has no member named ‘IsNearDeath’
npm ERR!   127 |     assert(wrap->handle_.IsNearDeath());
npm ERR!       |                          ^~~~~~~~~~~
npm ERR! In file included from ../../nan/nan.h:2818:
npm ERR! ../../nan/nan_typedarray_contents.h: In constructor ‘Nan::TypedArrayContents<T>::TypedArrayContents(v8::Local<v8::Value>)’:
npm ERR! ../../nan/nan_typedarray_contents.h:34:43: error: ‘class v8::ArrayBuffer’ has no member named ‘GetContents’
npm ERR!    34 |       data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
npm ERR!       |                                           ^~~~~~~~~~~
npm ERR! ../src/microtime.cc: In function ‘void NowStruct(const Nan::FunctionCallbackInfo<v8::Value>&)’:
npm ERR! ../src/microtime.cc:75:13: error: no matching function for call to ‘v8::Array::Set(Nan::imp::IntegerFactory<v8::Integer>::return_t, Nan::imp::FactoryBase<v8::Number>::return_t)’
npm ERR!    75 |   array->Set(Nan::New<v8::Integer>(0), Nan::New<v8::Number>((double)t.tv_sec));
npm ERR!       |   ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:244:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
npm ERR!   244 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
npm ERR!       |                                     ^~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:244:37: note:   candidate expects 3 arguments, 2 provided
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:247:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
npm ERR!   247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
npm ERR!       |                                     ^~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:247:37: note:   candidate expects 3 arguments, 2 provided
npm ERR! ../src/microtime.cc:76:13: error: no matching function for call to ‘v8::Array::Set(Nan::imp::IntegerFactory<v8::Integer>::return_t, Nan::imp::FactoryBase<v8::Number>::return_t)’
npm ERR!    76 |   array->Set(Nan::New<v8::Integer>(1), Nan::New<v8::Number>((double)t.tv_usec));
npm ERR!       |   ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:244:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’
npm ERR!   244 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
npm ERR!       |                                     ^~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:244:37: note:   candidate expects 3 arguments, 2 provided
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:247:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’
npm ERR!   247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
npm ERR!       |                                     ^~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/v8-object.h:247:37: note:   candidate expects 3 arguments, 2 provided
npm ERR! ../src/microtime.cc: At global scope:
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/node.h:1014:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR!  1014 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/user/.cache/node-gyp/18.18.2/include/node/node.h:1048:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!  1048 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../src/microtime.cc:95:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!    95 | NODE_MODULE(microtime, InitAll)
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [microtime.target.mk:113: Release/obj.target/microtime/src/microtime.o] Fehler 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
npm ERR! gyp ERR! System Linux 6.5.0-2-amd64
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /tmp/map-tiles-proxy/node_modules/microtime
npm ERR! gyp ERR! node -v v18.18.2
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok

centic9 avatar Nov 04 '23 08:11 centic9