mikaelbr / node-notifier

A Node.js module for sending notifications on native Mac, Windows and Linux (or Growl as fallback)
MIT License
5.74k stars 322 forks source link

Doesn't work on nexe #377

Closed lee1409 closed 2 years ago

lee1409 commented 3 years ago

I was trying to compile my node project into .exe using Nexe. I'm clueless because node-notifier does work on node but not .exe. The .exe file doesn't display any error or something that can give me some hints about what kind of problem I encountered.

Version "node-notifier": "^10.0.0", "nexe": "3.3.7"

yoavain commented 2 years ago

Doesn't work for me either

Version "node-notifier": "10.0.0", "nexe": "4.0.0-beta.19"

yoavain commented 2 years ago

I think I found something. It seems to be related to the customPath option. (This also fits the release notes that mention a fix there)

My notifierOptions:

{
    "withFallback": false,
    "customPath": "X:\\xxxxxxxxxx\\dist\\snoretoast-x64.exe"
}

Debug log

node-notifier debug info (fileCommand):
[notifier path] X:\xxxxxxxxxx\dist\vendor\snoreToast\snoretoast-x64.exe

Seems that somewhere along the way the vendor\snoreToast is added. Not sure if that's only when using an absolute path to the binary, or if it will happen to relative as well.

yoavain commented 2 years ago

Although the documentation note Relative/Absolute path to binary, even when removing the sonretoast-x64.exe from the customPath, the result is the same. So it seems the actual behavior of customPath is that it expects a folder with vendor\snoreToast\sonretoast-x64.exe rather then a path to binary itself.

yoavain commented 2 years ago

Found the problem. Opened a PR

yoavain commented 2 years ago

@lee1409 If your problem you're having is the same as mine, a temporary workaround can be sending customPath in the message options rather then in the WindowsToaster constructor

lee1409 commented 2 years ago

Alright thanks @yoavain ! Will try it when I'm available