node.js - require("electron").app is undefined. I npm installed fresh modules. Unsure what to do -
yesterday, developing on electron fine. hop onto computer realize electron isn't working @ now.
i removed node_modules
, did fresh npm install
package.json:
... "devdependencies": { "devtron": "^1.4.0", "electron": "^1.4.7" }, "dependencies": { "electron-debug": "^1.1.0" } ...
this error got.
i followed suggestions used of previous issues of problem. nothing resolving it.
electron not installed globally. should self contained in directory.
most of code taken electron boilerplate
edit:
main process:
'use strict'; const path = require('path'); const electron = require('electron'); const app = electron.app; // adds debug features hotkeys triggering dev tools , reload require('electron-debug')({ showdevtools: true }); // prevent window being garbage collected let mainwindow; function onclosed() { // dereference window // multiple windows store them in array 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(); });
so, in case. issue resolved using original terminal rather plugin terminal atom.
for out there. double check vanilla terminal or editor double check.
Comments
Post a Comment