Frans Thamura
Frans Thamura

Reputation: 11

cannot find module in electron prebuilt 1.x but in 0.x (0.2 and 0.3

I have a small code, that run well in electron (using prebuild 0.3.5, and 0.25).

I upgrade to electron prebuild 1.1.0 and 1.2.0

I got error

Uncaught Exception: Error: Cannot find module 'app' at Module._resolveFilename (module.js:438:15) at Function.Module._resolveFilename (/home/mervo/electron/midas-tron/node_modules/electron-prebuilt/dist/resources/electron.asar/common/reset-search-paths.js:47:12) at Function.Module._load (module.js:386:25) at Module.require (module.js:466:17) at require (internal/module.js:20:19) at Object. (/ho

I think there is a change in structure in 1.x, that I dont know, can help?

Upvotes: 0

Views: 480

Answers (1)

Vadim Macagon
Vadim Macagon

Reputation: 14847

The correct way to require the app module in Electron v1.0.0+ is:

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

The same applies to any other built-in Electron module you could previously require directly.

Upvotes: 1

Related Questions