Yesterday I developed very well on Electron. Then I jump onto my computer to understand that Electron is not working right now.
I deleted node_modulesand made a new onenpm install
package.json:
...
"devDependencies": {
"devtron": "^1.4.0",
"electron": "^1.4.7"
},
"dependencies": {
"electron-debug": "^1.1.0"
}
...
This is the error I received.
I followed suggestions from previous releases of this issue. Nothing permits this.
The electron is not installed globally. Everything should be included in the catalog.
npm list
Most of this code was taken from an electronic template.
Edit:
main process:
'use strict';
const path = require('path');
const electron = require('electron');
const app = electron.app;
require('electron-debug')({
showDevTools: true
});
let mainWindow;
function onClosed() {
mainWindow = null;
}
function createMainWindow() {
const display = electron.screen.getPrimaryDisplay();
const win = new electron.BrowserWindow({
width: display.workArea.width,
height: display.workArea.height
});
const projectPath = path.dirname(path.dirname(__dirname));
win.loadURL(`file://${projectPath}/static/index.html`);
win.on('closed', onClosed);
return win;
}
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (!mainWindow) {
mainWindow = createMainWindow();
}
});
app.on('ready', () => {
mainWindow = createMainWindow();
});
zyeek source
share