arvydas / blinkstick-node

Node.js library for BlinkStick devices.
MIT License
47 stars 39 forks source link

npm build Fails on macOS (Ventura 13.4.1) #47

Open andreschoque3 opened 1 year ago

andreschoque3 commented 1 year ago

I was following the installation process as indicated on the README file. I was trying to do an npm install blinkstick when I received all the errors below

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! code 1
npm ERR! path /Users/andreschoque/Desktop/blinkstick_js/blinkstick-node/node_modules/node-hid
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! CC(target) Release/obj.target/hidapi/hidapi/mac/hid.o
npm ERR!   LIBTOOL-STATIC Release/hidapi.a
npm ERR!   CXX(target) Release/obj.target/HID/src/HID.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@20.5.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.4 found at "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/local/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   '/Users/andreschoque/Desktop/blinkstick_js/blinkstick-node/node_modules/node-hid/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/andreschoque/Library/Caches/node-gyp/20.5.0/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=/Users/andreschoque/Library/Caches/node-gyp/20.5.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/andreschoque/Library/Caches/node-gyp/20.5.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/andreschoque/Desktop/blinkstick_js/blinkstick-node/node_modules/node-hid',
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 ../src/HID.cc:31:
npm ERR! In file included from ../../nan/nan.h:174:
npm ERR! ../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
npm ERR! typedef v8::Local<v8::AccessorSignature> Sig;
npm ERR!                   ~~~~^
npm ERR! In file included from ../src/HID.cc:31:
npm ERR! ../../nan/nan.h:680:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
npm ERR!     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
npm ERR!                                       ^
npm ERR! /Users/andreschoque/Library/Caches/node-gyp/20.5.0/include/node/v8-isolate.h:1291:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
npm ERR!   V8_DEPRECATE_SOON(
npm ERR!   ^
npm ERR! /Users/andreschoque/Library/Caches/node-gyp/20.5.0/include/node/v8config.h:550:39: note: expanded from macro 'V8_DEPRECATE_SOON'
npm ERR! # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
npm ERR!                                       ^
npm ERR! In file included from ../src/HID.cc:31:
npm ERR! ../../nan/nan.h:2536:8: error: no matching member function for call to 'SetAccessor'
npm ERR!   tpl->SetAccessor(
npm ERR!   ~~~~~^~~~~~~~~~~
npm ERR! /Users/andreschoque/Library/Caches/node-gyp/20.5.0/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'imp::Sig' (aka 'int') to 'v8::SideEffectType' for 7th argument
npm ERR!   void SetAccessor(
npm ERR!        ^
npm ERR! /Users/andreschoque/Library/Caches/node-gyp/20.5.0/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'v8::AccessorGetterCallback' (aka 'void (*)(Local<v8::String>, const PropertyCallbackInfo<v8::Value> &)') for 2nd argument
npm ERR!   void SetAccessor(
npm ERR!        ^
npm ERR! In file included from ../src/HID.cc:31:
npm ERR! In file included from ../../nan/nan.h:2884:
npm ERR! ../../nan/nan_typedarray_contents.h:34:43: error: no member named 'GetContents' in 'v8::ArrayBuffer'
npm ERR!       data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
npm ERR!                                   ~~~~~~~~^
npm ERR! ../src/HID.cc:67:5: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
npm ERR!     throw(JSException);
npm ERR!     ^~~~~~~~~~~~~~~~~~
npm ERR! ../src/HID.cc:67:5: note: use 'noexcept(false)' instead
npm ERR!     throw(JSException);
npm ERR!     ^~~~~~~~~~~~~~~~~~
npm ERR!     noexcept(false)
npm ERR! ../src/HID.cc:70:5: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
npm ERR!     throw(JSException);
npm ERR!     ^~~~~~~~~~~~~~~~~~
npm ERR! ../src/HID.cc:70:5: note: use 'noexcept(false)' instead
npm ERR!     throw(JSException);
npm ERR!     ^~~~~~~~~~~~~~~~~~
npm ERR!     noexcept(false)
npm ERR! ../src/HID.cc:152:3: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
npm ERR!   throw(JSException)
npm ERR!   ^~~~~~~~~~~~~~~~~~
npm ERR! ../src/HID.cc:152:3: note: use 'noexcept(false)' instead
npm ERR!   throw(JSException)
npm ERR!   ^~~~~~~~~~~~~~~~~~
npm ERR!   noexcept(false)
npm ERR! ../src/HID.cc:163:3: error: ISO C++17 does not allow dynamic exception specifications [-Wdynamic-exception-spec]
npm ERR!   throw(JSException)
npm ERR!   ^~~~~~~~~~~~~~~~~~
npm ERR! ../src/HID.cc:163:3: note: use 'noexcept(false)' instead
npm ERR!   throw(JSException)
npm ERR!   ^~~~~~~~~~~~~~~~~~
npm ERR!   noexcept(false)
npm ERR! ../src/HID.cc:608:31: error: too few arguments to function call, expected 3, have 2
npm ERR!   node::AtExit(deinitialize, 0);
npm ERR!   ~~~~~~~~~~~~                ^
npm ERR! /Users/andreschoque/Library/Caches/node-gyp/20.5.0/include/node/node.h:1263:18: note: 'AtExit' declared here
npm ERR! NODE_EXTERN void AtExit(Environment* env,
npm ERR!                  ^
npm ERR! 1 warning and 8 errors generated.
npm ERR! make: *** [Release/obj.target/HID/src/HID.o] Error 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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 22.5.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/20.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/andreschoque/Desktop/blinkstick_js/blinkstick-node/node_modules/node-hid
npm ERR! gyp ERR! node -v v20.5.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/andreschoque/.npm/_logs/2023-08-01T14_10_12_770Z-debug-0.log

I wanted to reach out to see which version of npm, node, or any other dependencies work Thanks,

bala9248 commented 8 months ago

@andreschoque3 Were you able to find a fix for this issue? I am facing the same problem when I am trying on Windows.

node version - v18.12.1

antti5 commented 7 months ago

@andreschoque3 @bala9248 Were either of you able to solve this?

I'm facing the same problem on Ubuntu 22.04, Node.js version 20.11.

andreschoque3 commented 7 months ago

sorry guys, I did not find a solution. Instead I used Ruby and it worked fine for me.

antti5 commented 7 months ago

sorry guys, I did not find a solution. Instead I used Ruby and it worked fine for me.

Roger that! It looks to me that adjusting the flags of the C++ compiler would solve this... Maybe I'll have a go at this.