Solution to electron error “cannot find module app”

Solution:

The original code looks like this:

var app = require('app');
var BrowserWindow = require('browser-window');

To be amended as follows:

const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;

Cause of error: the version of electron used is too new, and this API has been removed in electron v1.0.0. “Cannot find module…” appears again Basically, it’s all because the module is directly introduced by require. If there are errors in the introduction of other modules, you have to check the API now. Not all of them are “const Balabala”= electron.balabala ”For example, the introduction of IPC is:

const ipc = electron.ipcMain;

Read More: