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:
- An error is reported when the electron Vue Vue component introduces the electron
- Module not found: Error: Can’t resolve ‘./$$_gendir/app/app.module.ngfactory’
- Cannot find module ‘request’ is prompted after electron is packaged
- Attributeerror: module tensorflow no attribute app solution
- Error: Cannot find module’webpack/bin/config-yargs’ solution
- Error reported by nodejs server of CentOS system: solution to cannot find module ‘jQuery’
- Python error: importerror: DLL load failed: unable to find the specified module solution
- node.js Cannot find module “XXX” solution
- Error: solution to the problem of cannot find module ‘webpack / bin / config yargs’
- Solution to prompt “cannot find module ‘eslint config defaults / configurations / eslint’” when submitting with Git
- Error: Cannot find Module ‘Webpack-cli ‘- Solution
- About the solution of error: cannot find module ‘@ Babel / core’
- NPM error ‘cannot find module’ internal / util / types’ solution;
- Using Mocha to test can not find module ‘. /build/release/scrypt’ (Fixed)
- NPM- Cannot find module ‘xxxxx’
- Gulp Error: Cannot find module ‘jshint/src/cli’;
- [solution] a perfect solution to the problem of failed to load module “Canberra GTK module” in Ubuntu
- Module build failed: error: cannot find module ‘node sass’ error
- Solve the problem that the tray of electron system disappears automatically
- How to solve the problem of Cannot find module’npmlog’ when installing nodejs under Linux