2
Good morning to you all.
I’m a beginner with Electron and I can’t open mine index.html
through function win.loadFile()
. Simply open the following screen:
Could someone explain to me how to solve this and why it occurs? Dude main.js
:
const { app, BrowserWindow } = require('electron')
let win
function createWindow () {
win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
win.webContents.openDevTools()
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
UPDATE: I was able to solve by reinstalling Electron.
The message on the screen says that for you to run the local app you have to run the command below, came to do this?
– Albertt Santos
Yes, I did, but there was an error. I redid the installation of Electron and it worked. Thanks for the reply.
– JoaoPaulo