4

I am trying to package electron-react application. I am using electron-builder for that purpose.

electron version = 4.0.0 electron-builder version = 20.19.1

I am getting below error,

Error: Exit code: 1. Command failed: C:\Users\tak\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.4.0\rcedit-ia32.exe C:\Users\tak\Desktop\okta example\new example\OktaReactWeb\oktareactwebapp\dist\win-unpacked\oktareactwebapp.exe --set-version-string FileDescription oktareactwebapp --set-version-string ProductName oktareactwebapp --set-version-string LegalCopyright Copyright © 2019 Mangesh Tak --set-file-version 0.1.0 --set-product-version 0.1.0.0 --set-version-string InternalName oktareactwebapp --set-version-string OriginalFilename --set-version-string CompanyName Mangesh Tak Fatal error: Unable to commit changes

Please find below my package.json for electron-builder build config,

"build": {
    "appId": "com.example.electron-cra",
    "files": [
      "build/**/*",
      "node_modules/**/*"
    ],
    "directories": {
      "buildResources": "assets"
    },
    "extraMetadata": {
      "main": "build/electron.js"
    }
  },
  "author": "MT",
  "homepage": "./",
  "main": "public/electron.js",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "electron": "electron .",
    "electron-dev": "concurrently \"npm run start\" \"wait-on http://localhost:3000 && electron .\"",
    "preelectron-pack": "npm run build",
    "electron-pack": "build -c.extraMetadata.main=build/electron.js",
    "build-win": "npm run build && electron-builder --win portable --x64"
  },

I am running "npm run electron-pack" for packaging.

What am I doing wrong here?

Mangesh Tak
  • 346
  • 1
  • 6
  • 22
  • 1
    The issue still could be reproduced. When I came across this problem I noticed that there are lot of electron processes still running even yarn package command had already finished with error. I was able to finish packaging normally only when killed all of them and started the packaging process again. – Boris Davidov Oct 22 '19 at 05:39
  • 1
    I got similar error and turning off antivirus solved the issue – Inovramadani Dec 24 '19 at 16:39

3 Answers3

2

In my case, this issue was because McAfee's Antivirus real-time scanning is working.

To solve the issue, just turn off McAfee's Antivirus real-time scanning.

enter image description here

Ahmed Nabil
  • 17,392
  • 11
  • 61
  • 88
  • 1
    Just found this and this solved my problem packing my Electron App. Just started developing desktop apps and this solution was a life saver. Upvote! – TonyT Apr 17 '20 at 00:41
  • In my case, i had to run Visual Studio Code with ADMIN previledge, while packagin. – Palash Roy Sep 04 '20 at 07:18
0

In case nothing works, just delete dist folder or whatever is your output folder. This helped me on Windows11...

OSP
  • 1,458
  • 1
  • 14
  • 15
0

To fix this issue, you can either restart your computer or stop any 'electron.exe' processes in your Task Manager.

Ref: https://github.com/electron/electron-packager/issues/590#issuecomment-1416237580

Sivert
  • 5
  • 4