N-API callback exception when running above Rosetta
Opened this issue · 12 comments
Thanks for your great package!
I am trying to create an app deliverable for an Apple x64 architecture when running on an Apple arm64 architecture. I am using JZZ to send transport command to a DAW, and also to receive MTC messages from the DAW.
I am developing in VSCode, and have ensured that VSCode, its terminal, and node.js are running above the simulated x64 (Rosetta) architecture using arch and node -p "process.arch" commands. I am using JZZ commands to open input and output ports, to send messages, and I have used .connect to ensure the handling of MTC messages.
My app runs, and transport commands I send are successfully received by the DAW. However, the receipt of MTC messages results in a succession of the following message:
(node:41451) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly.
Any idea of how to prevent this callback exception and to pick up the MTC messages?
Hi! Thanks for asking!
Are you writing a VScode extension? In this case, you can try https://github.com/jazz-soft/jazz-midi-vscode
Sorry, I'm not familiar with Rosetta...
Hi, thanks for your response! No, I'm not writing a VSCode extension. I have created an immersive sound client/server program in javascript ( www.immersivedsp.com ). I was hoping to create the Intel Mac updates on my Mac silicon machine, rather than going to a separate Intel Mac. I have got closer to achieving this with JZZ than with other MIDI npm packages, but am just battling with the handling of incoming MTC messages.
I wonder if it helps if you rebuild https://github.com/jazz-soft/jazz-midi (see the node-gyp section) on your system...
I believe the problem must be in that module.
Thanks for following up with further help!
I cloned the jazz-midi folder into a folder in my project, changed to that folder, did an "npm install", and then a "node-gyp rebuild". I got an error indicating no binding file. I saw that there was a binding file in the node-gyp sub-folder, so changed to that and did an "npm install". I got the following error message:
"gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/jazz/jazz-midi.o
../jazz-midi.cpp:515:9: error: no matching function for call to 'napi_wrap'
XX (napi_wrap(env, self, Plg, destroy, 0, 0));"
I also tried to do a "node-gyp rebuild" here, but again got a similar error message:
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/jazz/jazz-midi.o
../jazz-midi.cpp:515:9: error: no matching function for call to 'napi_wrap'
XX (napi_wrap(env, self, Plg, destroy, 0, 0));
There does seem to be a problem with the 'napi_wrap' function? Any ideas about the way forward would be much appreciated!
Ok, this is something... I'll try to track it from there...
Thanks!
Please check out the latest version and see if it compiles...
Thank you very much, it compiles!:
"2 warnings generated.
SOLINK_MODULE(target) Release/jazz.node
gyp info ok "
I tried copying Release/jazz.node into node_modules/jazz-midi/bin/macos64
As before, I could send MIDI transport commands to a DAW, but the returning MTC caused the same error - "-force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly.
(node:80262) [DEP0168] DeprecationWarning: Uncaught N-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=trueto handle those exceptions properly."
Is there possibly something else I should be doing with the release build?
should it be called from bin/macos64 or bin/macosa64 ?
Ah, I assumed that it would be bin/macos64. I thought that the 'a' referred to 'arm'. When I place Release/jazz.node into node_modules/jazz-midi/bin/macosa64, the enumeration of MIDI ports doesn't happen, for example this command "midiOutPorts = JZZ().info().outputs;" returns an empty array. So it looks as if jazz.node is indeed called via bin/macosa64, but that my release build doesn't work. It's a bit late where I am now. I will have a further look at this tomorrow. Thanks again for your help.
Could you please give more details about the versions of your OS, node and npm?
macOS is 12.6.3, node is 18.20.3, npm is 10.7.0. I will be updating these all this week, and will have another try. Thanks for your continued support!