"cannot find module" error occured in the main process


#1

I’ve started encountering the below error yesterday when debugging my electron app. This used to work fine, and I haven’t made any changes. The ‘open’ module is in nodes_modules… not sure what to try next

it happens on this code:
mainWindow.webContents.on(‘will-navigate’, (e, url) => {
e.preventDefault();
require(“open”)(url);
});

Error
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'open’
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:289:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at EventEmitter. (…\main.js:68:9)
at emitTwo (events.js:87:13)
at EventEmitter.emit (events.js:172:7)

Thanks!


#2

Can you provide more information like what Electron version you are using, the directory structure of your app and if you are using more than two package.json files?