Robinfr / electron-react-typescript

Electron boilerplate with React, Redux, and TypeScript
MIT License
432 stars 85 forks source link

Using pre-compiled .node modules #20

Closed nolior closed 4 years ago

nolior commented 4 years ago

Hi,

I'm trying to use iohook with this repository and I'm running into issues. I'm not sure if I should post here or in the iohook repository, or somewhere else. This is the error message I receive:

Error: Cannot find module '/absolute_path_to_project/dist/builds/electron-v64-darwin-x64/build/Release/iohook.node'

I believe my current issue is related to how webpack is set up in this project? However, I'm a novice node developer with this being my first project so I could be wrong.

It seems that for OS X users (I'm on OS X 10.15) iohook comes with pre-built .node modules that will be referenced whenever you import and attempt to use iohook. When using iohook with this project, it will attempt to reference the module here: /absolute_path_to_project/dist/builds/electron-v75-darwin-x64/build/Release/iohook.node.

However, when I check the dist folder, there is no corresponding builds folder. My guess is that something is wrong with webpack and it doesn't properly copy this .node module?

I do see an iohook.node exists at this location: ./node_modules/iohook/builds/electron-v75-darwin-x64/build/Release/iohook.node.

Another theory I have is that somehow, because of how web pack is set up, the app is attempting to look for iohook in an incorrect location? Someone else ran into the same issue I have at the bottom of this issue (https://github.com/wilix-team/iohook/issues/55), however, it is looking for iohook.node at a different location: ./node_modules/iohook/builds/electron-v75-darwin-x64/build/Release/iohook.node

If anyone could provide some guidance on this issue (even if it's just to let me know that this is an incorrect diagnosis) that would be greatly appreciated.

Possibly relevant threads:

Robinfr commented 4 years ago

10.15 had problems before. I've updated several of the dependencies, this should fix your problem as well. Please reopen if the problem persists.