Reputation: 450
I have created and electron application and trying to use electron forge for building purpose. Please find below command which i have run it for creating the electron application:
#npm i -g create-react-app
#npm i -g @electron-forge/cli
#npx create-electron-app my-ele-app
The above last command created a project my-ele-app. and now i am able to start the application as well. #npm start.
content of package.json file is:
{
"name": "my-ele-app",
"productName": "my-ele-app",
"version": "1.0.0",
"description": "My Electron application description",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "rohit",
"email": "[email protected]"
},
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "my_ele_app"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
},
"dependencies": {
"electron-squirrel-startup": "^1.0.0"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.55",
"@electron-forge/maker-deb": "^6.0.0-beta.55",
"@electron-forge/maker-rpm": "^6.0.0-beta.55",
"@electron-forge/maker-squirrel": "^6.0.0-beta.55",
"@electron-forge/maker-zip": "^6.0.0-beta.55",
"electron": "12.0.9"
}
}
Now when i am running below command, it is throwing error:
#npm run make
Error is:
> [email protected] make
> electron-forge make
√ Checking your system
√ Resolving Forge Config
An unhandled rejection has occurred inside Forge:
Error: Could not find module with name: @electron-forge/maker-squirrel. Make sure it's listed in the devDependencies of your package.json
at _default (C:\Users\212807091\Desktop\Rohit\Office Note\RBAC\Electron_project\npx_electrong\my-ele-app\node_modules\@electron-forge\core\src\api\make.ts:125:15)
at C:\Users\212807091\Desktop\Rohit\Office Note\RBAC\Electron_project\npx_electrong\my-ele-app\node_modules\@electron-forge\cli\src\electron-forge-make.ts:44:5
Electron Forge was terminated. Location:
{}
NOTE: i can see there is module available in node_modules folder: my-ele-app\node_modules@electron-forge\maker-squirrel
If anyone here has any idea how to fix this issue. please provide the answer. Thanks!
Upvotes: 6
Views: 17409
Reputation: 11
If you are using Windows, this works for me:
Run npm i electron-winstaller --save-dev --ignore-scripts
Install 7zip x86 in your computer. After installed, go to C:\Program Files (x86)\7-Zip and copy both 7z.dll and 7z.exe files to /path/to/your_project/node_modules/electron-winstaller/vendor if they are not still there.
Run npm electron-forge import
again
Then try run npm run make
again. I hope it works.
Upvotes: -1
Reputation: 699
In my cases, it makes error when the description or author is empty in package.json file.
Upvotes: 5
Reputation: 588
I had a similar issue but I followed the instructions from here: https://www.electronjs.org/docs/latest/tutorial/quick-start#package-and-distribute-your-application
I missed calling npx electron-forge import
. So the full pipeline looks like this:
npm install --save-dev @electron-forge/cli
npx electron-forge import
npm run make
Upvotes: 9
Reputation: 396
you have installed all the required dependencies so just run this command
npm run package
And after this a folder with name out
is generated and inside that your .exe file will be present
Upvotes: 0
Reputation: 11
I got the same error after following the "Getting Started" instructions. Nothing resolved it until I ran npm install -g @electron-forge/cli@beta
-- after that finished I was able to successfully run electron-forge make
.
Also running npm run make did the same as electron-forge make as I didn't appear to have it installed. Another thing I noticed is that if I run npm run make with maker-squirrel at version 6.0.0-beta.55
then I get this error: Could not find module with name: @electron-forge/maker-squirrel
. However, if I re-install maker-squirrel as npm install --save-dev @electron-forge/[email protected]
and re-run npm run make
then I get an out folder with an exe
.
Upvotes: 1