undefinedfix
Sign in

Error report of electronic builder after packing, not found electron.js

dinara_pulseway edited in Fri, 23 Sep 2022

An error was reported after packing with electron, saying that it could not be found electron.js It's been installed several times package.json The configuration is as follows

{
  "name": "my-electron",
  "version": "0.1.0",
  "author": "Ruoduan",
  "private": true,
  "main": "main.js",
  "homepage": ".",
  "dependencies": {
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-scripts": "3.1.1"
  },
  "build": {
    "appId": "com.my-electron.app",
    "mac": {
      "target": [
        "dmg",
        "zip"
      ]
    },
    "win": {
      "target": [
        "nsis",
        "zip"
      ]
    }
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "electron-start": "electron .",
    "dist": "electron-builder --win --x64"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "electron": "^6.0.9",
    "electron-builder": "^21.2.0"
  }
}

clipboard.png

2 Replies
rrgze
commented on Fri, 23 Sep 2022

You have confused create react app with electron project. Try to replace the start script in scripts with the start script of electron

Iter
commented on Fri, 23 Sep 2022

Hello, have you solved it