Cannot find module 'app'


I get this error when I update to electron-prebuilt version 1.0.1 and try to start the app.


I’m having a similar problem.


In 1.0 there is only a single require called electron that all modules are properties on.

So instead of require('app') it is require('electron').app.

Is there a migration document out there somewhere?

There is an article here:

And also a few minor changes mentioned in:


My code is already structured as such. In fact, I don’t require('app') anywhere in my code.

The top of my file looks like this.

/* jshint node: true */
/* jshint esversion: 6 */

'use strict';

const electron = require('electron');
const path = require('path');

require('electron-reload')(__dirname, {
  electron: require('electron-prebuilt')
// Module to control application life.
const app =;
const BrowserWindow = electron.BrowserWindow;


I am having same issue. Have you figured out a fix?


Check your dependencies! I have found out the errors were comning from electron-window-state and electron-squirrel-startup, which had an older reuqire usage of app module (in fact they were using require('app'), now unsupported)
I updated those dependencies and the errors were gone.


This fixed my problem:
var electron = require(‘electron’);
var app =;
var BrowserWindow = electron.BrowserWindow;

var mainWindow = null;

app.on(‘ready’, function(){
mainWindow = new BrowserWindow({
width: 800,
height: 600


This error occurs because npm is looking for a folder app defined in package.json file


“scripts”: {
“start”: “electron ./app”,


"scripts": {
    "start": "electron .",




still facing same issue. can you please share any working example?

const {app} = require('electron');
const {BrowserWindow} = require('electron');

This solved it for me.


This can be shortened to

const {app, BrowserWindow} = require("electron");


This fixed my problem. Thanks.


I am having the same issue with electron . command.

  • This the code which I am using in my app.js file.
"use strict";

// const electron = require("electron");
// Module to control application life.
const { app } = require("electron");
// Module to create native browser window.
const { BrowserWindow } = require("electron");

  • error I am getting is this:
❯  npm start

> simple-electron@1.0.0 start /home/lalit/Desktop/Github/Electron/simple-electron/simple-electron-react
> electron .

App threw an error during load
Error: Cannot find module 'app'
    at Module._resolveFilename (module.js:485:15)
    at Function.Module._resolveFilename (/home/lalit/Desktop/Github/Electron/simple-electron/simple-electron-react/node_modules/electron-prebuilt-compile/node_modules/electron/dist/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/lalit/Desktop/Github/Electron/simple-electron/simple-electron-react/node_modules/electron-reload/main.js:1:166)
    at Object.<anonymous> (/home/lalit/Desktop/Github/Electron/simple-electron/simple-electron-react/node_modules/electron-reload/main.js:52:3)
    at Module._compile (module.js:569:30)
    at Object.require.extensions.(anonymous function) [as .js] (/home/lalit/Desktop/Github/Electron/simple-electron/simple-electron-react/node_modules/electron-compile/lib/require-hook.js:77:14)
    at Module.load (module.js:503:32)