node-notifier
node-notifier copied to clipboard
Not working on Apple Silicon
Trying to send a notification on an M1 MacBook produces an error:
Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:416:11)
at spawn (node:child_process:619:9)
at Object.execFile (node:child_process:262:17)
at Object.module.exports.fileCommandJson (/blah/blah/node_modules/node-notifier/lib/utils.js:83:13)
I suppose it comes down to the terminal notifier not having a native M1 build? I am not using Rosetta.
Confirmed
This is something that needs to be solved by dependency terminal-notifier
I'm afraid.
https://github.com/julienXX/terminal-notifier did not receive any update in three years, it's unlikely they'll solve any issue. On the other hand this issue will likely gain thrust as Apple plan to migrate all of their computer to the M1 chip eventually.
isn't it only a matter of re-compiling it to support AS? terminal-notifier is listed as supporting AS in Homebrew, I am not sure if it's through Rosetta2 or native. I don't have Rosetta2 so I will install and see if it works.
any idea on how to fix this?
It might be enough to recompile terminal-notifier. I'm unable to test/fix as I don't have access to M1 at the moment. If anyone could investigate and submit PR that would be much appreciated.
The easiest way is certainly to recompile. But you could probably also execute the macOS notifier tool with Rosetta like this arch -x86_64 vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier
If you don't want to recompile yourself, and keep avoiding Rosetta you can also install terminal-notifier via brew and change the path in node_modules/node-notifier/notifiers/notificationcenter.js
https://github.com/julienXX/terminal-notifier seems to be dead, https://github.com/vjeantet/alerter seems to be a reasonably active fork
alerter doesn't release m1 binaries but I was able to compile it fine on m1
Hey guys,
any news on this issue? It's still not working on a M1 out of the box and @joeflateau is right, terminal-notifier
looks not active at all.
The brew
solution from @08-15at to avoid Rosetta works, is really good and easy, but modifying a file in node_modules/
, for every project is not a real solution.
Running softwareupdate --install-rosetta
fixes it for me.
(I ran that as part of installing Docker as per https://docs.docker.com/desktop/mac/apple-silicon/; since that appears to be a compatibility layer for older Mac binaries, I wondered if it might also fix this problem, and it seems to!)
Hi, would it be possible to update the terminal-notifier binary from the currently utilized version 1.7.2 to version 2.0.0? Besides being from 2017 and might not supporting every possible options on newer macOSs, this latest version at least runs on a M1 Mac without having to install Rosetta first.
Hey, original author of terminal-notifier here :wave: I feel your pain, as I was wanting to use this project in a build of ours, so I'm looking into picking up maintenance myself again and publish new code-signed releases. Will report back when I have an update.
@alloy I just cloned https://github.com/julienXX/terminal-notifier and simply built it with absolutely no changes and it seems to compile fine for arm64.
Any chance of just releasing an update with no code changes just to resolve this issue?
Thanks!
$ lipo -archs ./DerivedData/Terminal\ Notifier/Build/Products/Release/terminal-notifier.app/Contents/MacOS/terminal-notifier
x86_64 arm64
Any news on this? 😅
I was facing the same issue and running what @candu suggested with softwareupdate --install-rosetta seems to have solved the issue for me
Hi @alloy, Any Update on terminal-notifier. Is it possible to create a universal build for it
Just want to chime in here, brand new M3 Pro, ran into this setting up an active project on the new machine. This fixed it immediately 👇 Thanks @candu !
Running
softwareupdate --install-rosetta
fixes it for me.(I ran that as part of installing Docker as per https://docs.docker.com/desktop/mac/apple-silicon/; since that appears to be a compatibility layer for older Mac binaries, I wondered if it might also fix this problem, and it seems to!)
Running
softwareupdate --install-rosetta
fixes it for me.(I ran that as part of installing Docker as per https://docs.docker.com/desktop/mac/apple-silicon/; since that appears to be a compatibility layer for older Mac binaries, I wondered if it might also fix this problem, and it seems to!)
This is fixed for me. Thanks!
Looking for a simple fix that is not rosetta - as that creates as many issues as it solves
For now I'm using patch-package. From your project's root directory:
brew install terminal-notifier
npm i -D patch-package
Open node_modules/node-notifier/notifiers/notificationcenter.js
and make the following changes and save:
-const notifier = path.join(
- __dirname,
- '../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier'
-);
+const notifier = '/opt/homebrew/bin/terminal-notifier';
Your path may differ, and if so simply run which terminal-notifier
to find your own path to the binary file.
Then to create the patch file, run from your project's root directory:
npx patch-package node-notifier
Then update your package.json
:
"scripts": {
+ "postinstall": "patch-package"
}
Commit everything including the new patch file and you'll be all set for future npm install
thanks to the postinstall
.
What's also nice is that patch-package
will let you know when node-notifier
has a version change to determine if you want to continue using a patch or if you can finally move off of it.
Instructions above will be slightly altered if you're using yarn
, just check the patch-package
docs as they're pretty easy for those adjustments.
You may also choose to not add the postinstall
script and instead rename it so that it must be manually run by only those who are affected by this change. We're only using it during local development and our team are all on devices with Apple Silicon, so it works for us for now, but YMMV. This is a band-aid, but at least a convenient one for non-critical projects.
I have access to an Intel Mac and an M2 Mac without Rosetta installed and running the examples with the commands node example/macInput.js
, node example/advanced.js
, and node example/message.js
work as expected and all tests pass on both machines with the changes in pull request #441. That pull request fixes the issues for people with Apple Silicon Macs that don't have Rosetta installed.
Thanks for your comment @TrevorSayre this worked for me.