Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'Unable to find a valid app' error building electron app using electron-packager

When running my application using npm start, everything works fine. However after building my app using electron-packager and open .exe file, it occurs: 'Unable to find a valid app' , complete description is

error

my packager.json file is:

{
  "name": "electron-roll-tool",
  "version": "1.0.0",
  "description": "A minimal Electron application",
  "main": "src/main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-packager ./src/ electron-roll-tool --win --out ../dist --arch=x64 --version=0.0.1 --overwrite --electron-version=1.8.4"
  },
  "repository": "https://github.com/alex1504/electron-roll-tool",
  "keywords": [
    "Electron"
  ],
  "author": "GitHub",
  "license": "MIT",
  "devDependencies": {
    "electron": "^1.8.4",
    "electron-packager": "^12.0.1"
  },
  "dependencies": {
    "moment": "^2.22.1",
    "xlsx": "^0.12.10"
  }
}

I change the entry point and my project structure is:

project structure

How to solve this problem?

like image 428
Zerui Hu Avatar asked Dec 09 '25 17:12

Zerui Hu


1 Answers

In the package.json, the 'build' command is incorrect. Replace ./src/ with ./ and then use ignore to exclude files and folders.

Because electron-packager needs the package.json in the src folder to know the main entrance and the dependencies, and also needs the dependencies in src

like image 169
Brian Tse Avatar answered Dec 11 '25 08:12

Brian Tse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!