electron: failed to create tray icon: error processing argument at index 0, conversion failure
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
- Electron Version: 8.0.0-beta2
- Operating System: Linux, Windows (have not tested on macOS)
- Last Known Working Electron version: 7.1.1
Expected Behavior
Tray icon with the specified image created.
Actual Behavior
Unhandled error processing argument at index 0, conversion failure error error is occurring. No tray icon created.
To Reproduce
https://github.com/vladimiry-playground/electron-quick-start-tray-issue
Screenshots


Tray icon with the specified image created if used v7.1.1 and below:

Additional Information
If used 8.0.0-beta2 there is no error if I construct the tray using the native image module like new Tray(nativeImage.createFromPath("image path")) but there is no visible tray icon either, but works for v7.1.1 and below.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (4 by maintainers)
Okay, I figured it out. This will be useful for any Electron Forge users.
My tray path is coded as:
The actual image is located in
src/assets/logoTemplate.pngI had to modify
webpage.main.config.jsusing the ‘copy-webpack-plugin’ npm module to copysrc/assetsinto the webpack build directory.contents of
webpage.main.config.js;Can confirm also happens on mac. I just upgraded from
7.1.1to8.0.0-beta.3and I got the error.I’m on macOS, and this was working on 6 and 7 version lines.
I just tried this as well, and it DOES work so it’s probably a configuration error on my end.
I suppose the problem could be simply the file is not found. I’m using electron forge / webpack which mucks with the paths of the files.
It’s an issue with underlying type marshalling between c++ and js - it’s platform agnostic.
I’ll hopefully have a fix up soon.