npm run make is not working in electron-forge
Asked Answered
P

6

6

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!

Pintsize answered 20/5, 2021 at 8:45 Comment(1)
Did you manage to fix this issueDrillstock
W
9

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
Wira answered 28/3, 2022 at 12:18 Comment(1)
I've done all the steps, but the app npm run make creates contains nothing, just an empty app, how could I fix that?Alpestrine
I
4

In my cases, it makes error when the description or author is empty in package.json file.

Incarnation answered 20/5, 2022 at 2:49 Comment(0)
B
1

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.

Bract answered 29/5, 2021 at 2:11 Comment(0)
W
0

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

Windhover answered 5/7, 2021 at 8:58 Comment(0)
V
-1

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.

Vina answered 20/4, 2022 at 12:2 Comment(0)
T
-1

Check the documentation. i solve same problem with this

Typo answered 29/11, 2022 at 3:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.