You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
at Module._resolveFilename (node:internal/modules/cjs/loader:1002:15)
at n._resolveFilename (node:electron/js2c/browser_init:2:109797)
at Module._load (node:internal/modules/cjs/loader:848:27)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1068:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/home/logicrays/Documents/practice project/Learn electronjs/web-tracker-electron-app/node_modules/iohook/index.js:24:21)
at Module._compile (node:internal/modules/cjs/loader:1174:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1229:10)
at Module.load (node:internal/modules/cjs/loader:1044:32)
Yes I resolved it.
The module iohook was not getting found after I create a build because the process was little bit wrong.
Assuming that you are using reactjs for UI.
Delete node_modules and run "npm install" first.
Then you need to run "PUBLIC_URL='./' npm run build" command as we are doing in all react applications. It will create a production build. Here we have to pass public url by which our react production build will be generate correctly and will get packages correctly from the node_modules.
scripts in package.json file will look like this
"build": "react-scripts build",
"builder": "electron-builder build",
Note: for every platform when you create a build, you need to pass public url.
linux: "PUBLIC_URL='./' npm run build"
windows: "$env:PUBLIC_URL='./'; npm run build"
mac: "PUBLIC_URL='./' npm run build"
Uncaught Exception:
Error: Cannot find module '/home/logicrays/Documents/practice project/Learn electronjs/web-tracker-electron-app/node_modules/iohook/builds/electron-v113-linux-x64/build/Release/iohook.node'
Require stack:
at n._resolveFilename (node:electron/js2c/browser_init:2:109797)
at Module._load (node:internal/modules/cjs/loader:848:27)
at f._load (node:electron/js2c/asar_bundle:2:13330)
at Module.require (node:internal/modules/cjs/loader:1068:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/home/logicrays/Documents/practice project/Learn electronjs/web-tracker-electron-app/node_modules/iohook/index.js:24:21)
at Module._compile (node:internal/modules/cjs/loader:1174:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1229:10)
at Module.load (node:internal/modules/cjs/loader:1044:32)
const { app, BrowserWindow, globalShortcut } = require("electron");
const windowStateKeeper = require("electron-window-state");
const path = require('path');
const ioHook = require('iohook');
let win;
let webContents;
function createWindow() {
const mainWindowState = windowStateKeeper({
defaultHeight: 800,
defaultWidth: 800,
})
}
app.whenReady().then(createWindow);
The text was updated successfully, but these errors were encountered: