Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require(electron) is not defined #945

Open
capitanhazel opened this issue Oct 30, 2024 · 1 comment
Open

require(electron) is not defined #945

capitanhazel opened this issue Oct 30, 2024 · 1 comment

Comments

@capitanhazel
Copy link

capitanhazel commented Oct 30, 2024

Context

Good morning, i'm having a persistent issue across all electron projects, including test projects. Nothing seems to get this strange issue away. Any help would be greatly appreciated!

Note

There is one additional error:

VS Code console is showing strange errors when opening devtools inside of electron. Bug?

[14312:1030/100255.584:ERROR:CONSOLE(1)] "Request Autofill.setAddresses failed. {"code":-32601,"message":"'Autofill.setAddresses' wasn't found"}", source: devtools://devtools/bundled/core/protocol_client/protocol_client.js (1)

View the project files

I downloaded the example project via this repo itself

since electron does not come installed with the project, i used the bash commands from README.md

Error

> Uncaught ReferenceError: require is not defined
    at main.js:1

Things i've tried

None working as of now...

  • Uninstalled & reinstalled electron
  • Checked global installations for electron
  • Researched with AI
  • Installed latest version of electron

Version & info

index.html is loading properly, along with preload.js & renderer.js

IDE VSCode
OS Windows 10
Package manage NPM
Node Node.js 20.18.0
Electron 33.0.2
Chromium 130.0.6723.59

Thanks for reading, here, take this 🍪 Virtual cookie.

@shalinikatore32
Copy link

shalinikatore32 commented Dec 26, 2024

Error

> Uncaught ReferenceError: require is not defined
    at main.js:1

const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
},
contextIsolation: false,
nodeIntegration: true
})

#try adding this in your main.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants