justinlatimer / node-midi

A node.js wrapper for RtMidi providing MIDI I/O
MIT License
743 stars 118 forks source link

Unabled to install under Node.js v21+ #236

Open djipco opened 9 months ago

djipco commented 9 months ago

When I try to install the midi module on macOS 12.2.1 via npm install midi, I get an error. This seems to be specific to Node.js v21+ because it's working fine under Node.js v20.

Here's the output log:

npm ERR! code 1
npm ERR! path /Users/xxxxxx/xxxx/xxxxxxx/xxxx/xxxxxxxxxx/WebMidi/node_modules/midi
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/midi/vendor/rtmidi/RtMidi.o
npm ERR!   CXX(target) Release/obj.target/midi/src/input.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@21.2.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.7.4 found at "/Users/xxxxxx/miniconda/bin/python3"
npm ERR! gyp info spawn /Users/xxxxxx/miniconda/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/xxxxxx/xxxx/xxxxxxx/xxxx/xxxxxxxxxx/WebMidi/node_modules/midi/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/xxxxxx/Library/Caches/node-gyp/21.2.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/xxxxxx/Library/Caches/node-gyp/21.2.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/xxxxxx/Library/Caches/node-gyp/21.2.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/xxxxxx/xxxx/xxxxxxx/xxxx/xxxxxxxxxx/WebMidi/node_modules/midi',
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/input.cpp:1:
npm ERR! ../../nan/nan.h:686: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/xxxxxx/Library/Caches/node-gyp/21.2.0/include/node/v8-isolate.h:1339:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
npm ERR!   V8_DEPRECATE_SOON(
npm ERR!   ^
npm ERR! /Users/xxxxxx/Library/Caches/node-gyp/21.2.0/include/node/v8config.h:551:39: note: expanded from macro 'V8_DEPRECATE_SOON'
npm ERR! # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
npm ERR!                                       ^
npm ERR! ../src/input.cpp:91:23: warning: 'Call' is deprecated [-Wdeprecated-declarations]
npm ERR!         callback_emit.Call(input->handle(), 3, info);
npm ERR!                       ^
npm ERR! ../../nan/nan.h:1723:3: note: 'Call' has been explicitly marked deprecated here
npm ERR!   NAN_DEPRECATED inline v8::Local<v8::Value>
npm ERR!   ^
npm ERR! ../../nan/nan.h:110:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR!                                        ^
npm ERR! In file included from ../src/input.cpp:1:
npm ERR! In file included from ../../nan/nan.h:60:
npm ERR! In file included from /Users/xxxxxx/Library/Caches/node-gyp/21.2.0/include/node/node.h:73:
npm ERR! In file included from /Users/xxxxxx/Library/Caches/node-gyp/21.2.0/include/node/v8.h:24:
npm ERR! In file included from /Users/xxxxxx/Library/Caches/node-gyp/21.2.0/include/node/v8-array-buffer.h:12:
npm ERR! /Users/xxxxxx/Library/Caches/node-gyp/21.2.0/include/node/v8-local-handle.h:253:5: error: static_assert failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value' "type check"
npm ERR!     static_assert(std::is_base_of<T, S>::value, "type check");
npm ERR!     ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../../nan/nan_callbacks_12_inl.h:175:20: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Data>' requested here
npm ERR!       cbinfo(info, obj->GetInternalField(kDataIndex));
npm ERR!                    ^
npm ERR! 2 warnings and 1 error generated.
npm ERR! make: *** [Release/obj.target/midi/src/input.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.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 21.3.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/xxxxxx/xxxx/xxxxxxx/xxxx/xxxxxxxxxx/WebMidi/node_modules/midi
npm ERR! gyp ERR! node -v v21.2.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

Thanks for your help and for this nice lib!

Julusian commented 9 months ago

This project looks to not be maintained anymore. Instead you can use my fork @julusian/midi See https://github.com/justinlatimer/node-midi/pull/228 for more details on the key changes.

djipco commented 9 months ago

@Julusian Thank you so much for chiming in! I installed your vision without any issues. Cheers!