#app is undefined
20 messages · Page 1 of 1 (latest)
I think you need to give more info about your config if you want help
well I have no clue whats wrong so i dont know what i need to share
Wlle let's see. Your package.json and file structure for a start
const { app, BrowserWindow } = require('electron');
const path = require('node:path');
const createWindow = () => {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
mainWindow.loadFile('index.html')
}
console.log(app)
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
what's the name of this file?
okay
you don't start if with electron
"scripts": {
"start": "node app.js"
},
this script is wrong
what would be correct then?
I suggest you read the quick start guide
This guide will step you through the process of creating a barebones Hello World app in Electron, similar to electron/electron-quick-start.
it gave me an error so i didnt think it would work
why instructions in the official quick start guide would not work?
thats a very good question