'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 startWhat could I be doing wrong?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Thomas Nicolai |
