I am developing a desktop application for Windows using ElectronJS. I want to include the RobotJS module in my project, but I can't seem to figure out how to do it. I successfully downloaded the module by running 'npm install robotjs' and called it in the main.js file. However, when I try to launch the application, I get the error shown in the image below. What could be causing this issue? I would be very grateful if you could help me solve my problem. If there is any additional information you need to learn in order to solve the issue, please let me know and I will send it quickly. Thank you in advance for your assistance!
main.js file:
const { app, BrowserWindow, Tray, Menu, ipcMain } = require('electron');
const path = require('path');
var robot = require("robotjs");
let mainWindow = null;
let tray = null;
function createWindow() {
mainWindow = new BrowserWindow({
width: 1182,
height: 503,
show: true,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
},
autoHideMenuBar: true,
resizable: false,
fullscreenable: false
});
mainWindow.loadFile('index.html');
mainWindow.on('close', (event) => {
event.preventDefault();
mainWindow.hide();
});
}
function createTray() {
tray = new Tray(path.join(__dirname, 'img/cf.ico'));
const contextMenu = Menu.buildFromTemplate([
{
label: 'Exit',
click: () => {
app.exit();
},
},
]);
tray.on('click', () => {
mainWindow.show();
});
tray.setToolTip('Casefife Prodeck');
tray.setContextMenu(contextMenu);
}
app.on('ready', () => {
createTray();
createWindow();
});
app.on('activate', () => {
if (mainWindow === null) {
createWindow();
}
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
I can't include the RobotJS module in my ElectronJS project