reactjslinuxnpmelectrondev-to-production

Electron application installed in system does not open because "iohook" library used in the "main.ts" file


I am making an application using ElectronJS and I am facing an issue. FYI: I am using electron-react-boilerplate for my application. And I use a npm library called iohook to catch all the system inputs like key pressed etc..

So, I create ".deb" file for my linux using:

npm run package --linux

After this, I install the generated file using

sudo apt install ./fileName

Now, when I try to open this installed application by clicking on it it does not open. But when I comment all the code in "main.ts" file which is related to "iohook" and then create a build and install the application in system it opens up perfectly. So, the main issue is the "iohook" library is not running in the production environment but runs perfectly in the development. What should I do to make it run in production as well?

Electron version: 8.5.2
iohook version:  ^0.9.3

I cannot use higher(or latest) version of Electron or else I get issues because of version incompatibility.

Edit: Here is the link to the project repo https://gitlab.com/vgoyal23/electron-apps


Solution

  • Found the answer in the issue below. I had to add iohook not just to /package.json but also in the /release/app/package.json. Refer this issue https://github.com/wilix-team/iohook/issues/414