thekingistheruler
thekingistheruler

Reputation: 79

I got "Error: packageJSON.main must be set to a valid entry point for your Electron app" when building with electron forge

I was building with electron forge and then it gave me this error in my terminal.

    An unhandled rejection has occurred inside Forge:
    Error: packageJSON.main must be set to a valid entry point for your Electron app
    
    Electron Forge was terminated. Location:
    {}

My package.json looks like this:

{
  "name": "elephant",
  "version": "1.0.0",
  "description": "my new app",
  "main": "main.js",
  "scripts": {
    "test": "elephant-test",
    "start": "electron ."
  },
  "keywords": [
    "editor",
    "live-preview",
    "html"
  ],
  "author": "unknown",
  "license": "MIT",
  "devDependencies": {
    "electron": "^16.0.7"
  }
}

I am unable to resolve this issue. The app works fine when I put in:

npm start
What could I be doing wrong?

Upvotes: 6

Views: 2716

Answers (1)

Thomas Nicolai
Thomas Nicolai

Reputation: 71

Ran into the same problem, for me it worked adding:

"main": "./dist/main.js",

to my package.json, because it's there I was building to.

Upvotes: 7

Related Questions