felixhao28 / node-systray

A cross-platform systray library for nodejs.
https://www.npmjs.com/package/systray2
MIT License
32 stars 8 forks source link

Doesn't seem to be working with PKG #12

Open Lucky38i opened 2 years ago

Lucky38i commented 2 years ago

It works great when building locally with PKG and running the .exe in my repo folder however using GHA to build releases I'm getting startup errors of failing to find the tray_windows.exe. I've tried adding the executable as an asset but getting the same error. Any ideas?

felixhao28 commented 2 years ago

https://github.com/felixhao28/node-systray/blob/master/index.ts#L95:L122

This is how node-systray finds the tray_windows.exe. Generally speaking, it will search for "traybin\tray_windows.exe" under current working directory and the script's location. The location is hard-coded for the time-being.

Lucky38i commented 2 years ago

Hi @felixhao28 Sorry for the delay. I'm getting this error reported from other users image

felixhao28 commented 2 years ago

The executables are external resources that need a customized building step. Typically, you need to find the "tray_windows_release.exe" (in Windows), and copy it into your final distributable package. When unpacked on users' computer, you need to make sure the install program copies the "tray_windows_release.exe" into the 'traybin" folder.

I am not sure what "adding the executable as an asset" means. In my case with Webpack, I use "webpack-copy-plugin" to ensure the output folder contains a copy of the "tray_xxxx_release" executable.

lakotajames commented 6 months ago

In case someone finds this later, the fix is to add "assets": "node_modules/systray2/traybin/tray_windows_release.exe" to pkg in your package.json