electron-ipc-stream icon indicating copy to clipboard operation
electron-ipc-stream copied to clipboard

Uncaught exception: cannot find module app

Open Mutharasi opened this issue 9 years ago • 5 comments

ipc-app When I am trying to run this electron-ipc-stream app, i am getting this "Uncaught Exception: Error: Cannot find module 'app' ". Please any one help me to resolve this issue.

Mutharasi avatar Oct 13 '16 06:10 Mutharasi

I installed app npm. Now the above error is solved. But I am getting another error now. electron-err

Mutharasi avatar Oct 13 '16 08:10 Mutharasi

After trying little bit, now getting this error. Please anyone help me bw

Mutharasi avatar Oct 13 '16 08:10 Mutharasi

A module that you're using is expecting an old version of electron. Are you sure that you're using the latest electron-ipc-stream?

jprichardson avatar Oct 13 '16 15:10 jprichardson

Yes I am using the latest. Just yesterday I downloaded the sample and tried. I first did - npm install, if any packages missing, i installed it separately, and I run the app using "electron ./test/main-to-read/". Then I got the error.

Mutharasi avatar Oct 14 '16 04:10 Mutharasi

For others who may have this problem still, I ran into this same sequence of errors. It was because the code for index.js or main.js needed to use updated syntax for the new version of electron. New: const {app} = require('electron') const {BrowserWindow} = require('electron')

app.on('ready', function() { var mainWindow = new BrowserWindow({ width: 800, height: 600 }) mainWindow.loadURL('file://' + __dirname + '/index.html') })

Instead of the old: var app = require('app') var BrowserWindow = require('browser-window')

app.on('ready', function() { var mainWindow = new BrowserWindow({ width: 800, height: 600 }) mainWindow.loadUrl('file://' + __dirname + '/index.html' })

I found this updated code in the comments of this youtube video: https://www.youtube.com/watch?v=ojX5yz35v4M

If this does not work, refer to the getting started example in the electron docs to see the updated syntax: https://github.com/electron/electron/blob/master/docs/tutorial/first-app.md

whiteanvi avatar Apr 04 '18 20:04 whiteanvi