justinlatimer / node-midi

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

Fails to Install on Apple Silicon M1 Macs #215

Closed chrisspiegl closed 2 years ago

chrisspiegl commented 2 years ago

Hello, I just tried using one of my projects which includes easymidi and by extension node-midi on my new M1 MacBook and it fails to install.

I was able to narrow it down to the dependency on opencv4nodejs-prebuilt and was wondering if it may be possible to work around this issue? Possibly work with an alternative library?

I also requested support for M1 on the opencv4nodejs-prebuilt repository: https://github.com/nut-tree/opencv4nodejs/issues/14

Any help would be appreciated.

I am trying to not have to run Node.JS inside a Rosetta Container and get this project up and running natively.

Looking forward to hopefully finding a solution together.

chrisspiegl commented 2 years ago

Sorry, I put in some further investigation and found out that this was not at all the fault of this package but a different dependency. If I could I would delete this issue but since that's impossible… I'll be closing it.

alana314 commented 11 months ago

I had a world of pain getting this installed and working with electron, so I wanted to share what finally worked (and stopped the NODE_MODULE_VERSION and mach-o x64 errors):

npm install midi --build-from-source --target_arch=arm64 --fallback-to-build
npm install --save-dev @electron/rebuild
./node_modules/.bin/electron-rebuild -f --arch=arm64
Julusian commented 11 months ago

This project looks to not be maintained anymore. Instead you can use my fork @julusian/midi. It includes prebuilt binaries for common platforms, avoiding the need to compile it locally in almost all cases. See https://github.com/justinlatimer/node-midi/pull/228 for more details on the changes.

alana314 commented 11 months ago

@Julusian thanks! I did still have to ./node_modules/.bin/electron-rebuild -f --arch=arm64 with your package or it would by default try and use a mach-o x86 build.

Julusian commented 11 months ago

Oh right yeah. I forgot that https://github.com/electron/rebuild/issues/1055 is still an 'issue'. It shouldn't need to rebuild it, but electron-rebuild isnt smart enough to realise that, so it does it anyway and I guess sometimes gets it wrong?

In my electron projects I don't have any dependencies which need rebuilding, so I have turned rebuilding off to avoid these issues