I'm quite confused as why my electron app doesn't launch when I used npm run electron:serve
for my project, but when my friend try it in his laptop he can run and the apps launch normally ,so Is there anyone here ever face the same problem with me? if there is someone, how did you solve this problem?
im on windows 10 64bit i saw someone said you can fix it by changing the theme to light but it didnt work
here is my Package.json file :
{
"name": "security_cams_management_app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@electron/remote": "^2.0.9",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"main": "./public/main.js",
"homepage": "./",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"electron:serve": "concurrently -k \"cross-env BROWSER=none npm start \" \"npm run electron:start\"",
"electron:build": "yarn build && electron-builder -c.extraMetadata.main=build/main.js",
"electron:start": "wait-on tcp:3000 && electron ."
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^8.0.1",
"cross-env": "^7.0.3",
"electron": "^24.0.0",
"wait-on": "^7.0.1"
}
}
and here is my main.js file :
const { app, BrowserWindow } = require('electron')
require('@electron/remote/main').initialize()
function createWindow() {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
enableRemoteModule: true,
},
})
win.reload('https://localhost:3000')
}
app.on('ready', createWindow)