question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

require(electron) doesn't work with eel.start

See original GitHub issue

My code:

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

const {app, BrowserWindow, Menu} = electron;

let mainWindow;

//Listen for app to be ready
app.on('ready', function(){
    //Create new window
    mainWindow = new BrowserWindow({});
    //Load HTML into window
    mainWindow.loadURL(url.format({
        pathname: path.join(__dirname, 'index.html'),
        protocol:'file',
        slashes: true
    }));
    //Using the menu Template we made down outside this funciton
    const mainMenu = Menu.buildFromTemplate(menuTemplate);
    //Insert the Menu
    Menu.setApplicationMenu(mainMenu);
});

//Creating a menu template.
//This is what shows up on the menubar on top.
const menuTemplate = [
    {
        label: 'Connection Management',
        submenu:[
            {
                label: 'Start Listening',
                click(){
                    dumbpy();
                }
            },
            {
                label: 'Stop Listening'
            },
            {
                label: 'EDAAC'
            }
        ]
    }
]

The menu only shows when I do npm start in the director. It doesn’t when I run the .py file. When I open the the inspect element, I get this : Uncaught ReferenceError: require is not defined at main.js:1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
ChrisKnottcommented, May 30, 2019

Hi guys, I will post an example Electron demo this evening that you can copy

0reactions
04fsnapecommented, Jun 13, 2019

@CyberSinister Did you just download the folder then run npm install? I can’t tell if you can’t get the demo working or you tried editing your current program to add some stuff from the demo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

require(electron) doesn't work with eel.start · Issue #148 - GitHub
require (electron) doesn't work with eel.start #148. Closed. CyberSinister opened this issue on May 28, 2019 · 10 comments.
Read more >
Uncaught ReferenceError: require is not defined with EEL
I am Trying to run html page with electron + eel. I have successfully loaded the webpage + eel.js. My Problem is whenever...
Read more >
Eel - Bountysource
Eel. A little Python library for making simple Electron-like HTML/JS GUI apps ... easily used to reproduce the problem or understand what I...
Read more >
eelJINJAenv · PyPI
Eel is not as fully-fledged as Electron or cefpython - it is probably not suitable ... Additional options can be passed to eel.start()...
Read more >
Eel options - DEV Community ‍ ‍
start line, application will be blocked, thus, remaining code won't be executed. If you want to run eel and not get stuck at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found