connors / photon

The fastest way to build beautiful Electron apps using simple HTML and CSS
photonkit.com
MIT License
10k stars 577 forks source link

Error: Cannot find module 'remote' #122

Open andig opened 7 years ago

andig commented 7 years ago

I'm using app.js and have added dev tools. In the console I'm getting Error: Cannot find module 'remote' in module.js 440. I have not changed the repo structure.

Any idea what might be the problem with finding remote?

andig commented 7 years ago

It might be that with current versions of electron it should read something like this:

var remote = require('electron').remote;
var Menu = remote.Menu;
var MenuItem = remote.MenuItem;
samuelyeshua commented 7 years ago

But because you are making use of "remote" in the main process when it is made to be used in the application renderer side?

In Electron, GUI-related modules (such as dialog, menu etc.) are only available in the main process, not in the renderer process. In order to use them from the renderer process, the ipc module is necessary to send inter-process messages to the main process. With the remote module, you can invoke methods of the main process object without explicitly sending inter-process messages, similar to Java’s RMI. --- Remote Docs

Ie these modules are not indexed to the "remote"