electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Fatal error: Unable to commit changes on build

Open Stanzilla opened this issue 6 months ago • 1 comments

Hey there, just came back to building an app and it failed with the above error.

Any idea what cause this? I already wiped node_modules and reinstalled fresh.

I also tested:

  • electron-builder 26.0.12
  • downgrading to pnpm 9 to rule out the new having to approve scripts thing
  • it works in CI, so has to be something in my setup, nothing apart from npm packages changed recently though afaik
  • Is it confused because the project is on a different drive from the e-b cache?
• electron-builder  version=26.0.16 os=10.0.26100
  • artifacts will be published if draft release exists  reason=CI detected
  • loaded configuration  file=F:\projects\personal\wago-app\electron-builder.json
  • writing effective config  file=release\2.6.3\builder-effective-config.yaml
  • executing @electron/rebuild  electronVersion=36.3.2 arch=x64 buildFromSource=false appDir=./
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=win32 arch=x64 electron=36.3.2 appOutDir=release\2.6.3\win-unpacked
(node:16444) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
  • updating asar integrity executable resource  executablePath=release\2.6.3\win-unpacked\Wago App.exe
  ⨯ cannot execute  cause=exit status 1
                    errorOut=Fatal error: Unable to commit changes

                    command='C:\Users\Stan\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\rcedit-x64.exe' 'F:\projects\personal\wago-app\release\2.6.3\win-unpacked\Wago App.exe' --set-version-string FileDescription 'Wago App' --set-version-string ProductName 'Wago App' --set-version-string LegalCopyright 'Copyright © 2025 The Wago Dev Team' --set-file-version 2.6.3 --set-product-version 2.6.3.0 --set-version-string InternalName 'Wago App' --set-version-string OriginalFilename '' --set-version-string CompanyName 'The Wago Dev Team' --set-icon 'F:\projects\personal\wago-app\release\2.6.3\.icon-ico\icon.ico'
                    workingDir=
  • Above command failed, retrying 3 more times

Stanzilla avatar Jun 03 '25 21:06 Stanzilla

Tbh, I pulled this with GPT, but overall, it aligns with what I was assuming as well: permission/file lock since it only affects your local machine.

errorOut=Fatal error: Unable to commit changes
command='C:\Users\Stan\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\rcedit-x64.exe'

means that rcedit-x64.exe failed to update the Windows executable metadata — often during icon, version, or manifest injection in Electron app packaging.

This usually happens due to permission issues or file locking.


✅ Common Causes & Fixes

1. File is locked / in use

  • Ensure the .exe file isn’t running or locked by another process (like antivirus or Windows Defender).
  • Try running the build again after a reboot or killing lingering processes.

2. Antivirus interference

  • Some antivirus software blocks rcedit from modifying executables.
  • Temporarily disable antivirus or add an exclusion for the electron-builder cache directory and your app's output folder.

3. Insufficient permissions

  • Even though you're building from an admin account, file ACLs might still block writes.

  • Try running your terminal as Administrator:

    • Right-click on your terminal (e.g., PowerShell, CMD, or VSCode) → “Run as administrator”.

🛠️ Debugging Tips

You can run rcedit manually to see what’s going wrong:

"C:\Users\Stan\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\rcedit-x64.exe" "path\to\your.exe" --set-version-string "CompanyName" "My Company"

This might give a more detailed error.

mmaietta avatar Jun 06 '25 00:06 mmaietta

Sorry for the late response, yes that got rid of the initial error, now it is stuck at this one, I hate Windows

 packaging       platform=win32 arch=x64 electron=37.0.0 appOutDir=release\2.6.3\win-unpacked
(node:18872) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
  ⨯ Unexpected end of JSON input  failedTask=build stackTrace=SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at NpmNodeModulesCollector.parseDependenciesTree (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\node-module-collector\npmNodeModulesCollector.ts:51:17)
    at NpmNodeModulesCollector.getDependenciesTree (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:44:17)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at NpmNodeModulesCollector.getNodeModules (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:16:21)
    at computeNodeModuleFileSets (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\util\appFileCopier.ts:184:14)
    at F:\projects\personal\wago-app\node_modules\app-builder-lib\src\platformPackager.ts:490:34
    at async Promise.all (index 0)
    at AsyncTaskManager.awaitTasks (F:\projects\personal\wago-app\node_modules\builder-util\src\asyncTaskManager.ts:65:25)
    at WinPackager.doPack (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\platformPackager.ts:307:5)
 ELIFECYCLE  Command failed with exit code 1.

Stanzilla avatar Jun 24 '25 21:06 Stanzilla

I believe that's due to the shell: true requirement for windows to execute .cmd and other scripts, such as npm.CMD. If your shell profile console logs anything, it'll break the JSON parsing logic

I'm working on finding an alternative manner of properly parsing the json output of npm list while having shell: false

mmaietta avatar Jun 24 '25 22:06 mmaietta

I believe that's due to the shell: true requirement for windows to execute .cmd and other scripts, such as npm.CMD. If your shell profile console logs anything, it'll break the JSON parsing logic

I'm working on finding an alternative manner of properly parsing the json output of npm list while having shell: false

Ah I see, did that change recently in EB or did I just run into it now?

Stanzilla avatar Jul 02 '25 17:07 Stanzilla

 • electron-builder  version=26.0.19 os=10.0.26120
  • artifacts will be published if draft release exists  reason=CI detected
  • loaded configuration  file=F:\projects\personal\wago-app\electron-builder.json
  • writing effective config  file=release\2.6.4\builder-effective-config.yaml
  • executing @electron/rebuild  electronVersion=37.2.3 arch=x64 buildFromSource=false appDir=./
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=win32 arch=x64 electron=37.2.3 appOutDir=release\2.6.4\win-unpacked
  ⨯ dependency tree output file is empty, retrying  error=Failed to parse dependencies tree: Unexpected end of JSON input. Use DEBUG=electron-builder env var to see the dependency query output. tempOutputFile=C:\Users\Stan\AppData\Local\Temp\t-xWK3RP\npm-0-output.json
  ⨯ dependency tree output file is empty, retrying  error=Failed to parse dependencies tree: Unexpected end of JSON input. Use DEBUG=electron-builder env var to see the dependency query output. tempOutputFile=C:\Users\Stan\AppData\Local\Temp\t-xWK3RP\npm-0-output.json
  ⨯ dependency tree output file is empty, retrying  error=Failed to parse dependencies tree: Unexpected end of JSON input. Use DEBUG=electron-builder env var to see the dependency query output. tempOutputFile=C:\Users\Stan\AppData\Local\Temp\t-xWK3RP\npm-0-output.json
  ⨯ Failed to parse dependencies tree: Unexpected end of JSON input. Use DEBUG=electron-builder env var to see the dependency query output.  failedTask=build stackTrace=Error: Failed to parse dependencies tree: Unexpected end of JSON input. Use DEBUG=electron-builder env var to see the dependency query output.
    at retries (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:62:17)
    at retry (F:\projects\personal\wago-app\node_modules\builder-util-runtime\src\retry.ts:9:12)
    at retry (F:\projects\personal\wago-app\node_modules\builder-util-runtime\src\retry.ts:13:14)
    at retry (F:\projects\personal\wago-app\node_modules\builder-util-runtime\src\retry.ts:13:14)
    at NpmNodeModulesCollector.getNodeModules (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\node-module-collector\nodeModulesCollector.ts:24:21)
    at computeNodeModuleFileSets (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\util\appFileCopier.ts:184:14)
    at F:\projects\personal\wago-app\node_modules\app-builder-lib\src\platformPackager.ts:490:34
    at async Promise.all (index 0)
    at AsyncTaskManager.awaitTasks (F:\projects\personal\wago-app\node_modules\builder-util\src\asyncTaskManager.ts:65:25)
    at WinPackager.doPack (F:\projects\personal\wago-app\node_modules\app-builder-lib\src\platformPackager.ts:307:5)
 ELIFECYCLE  Command failed with exit code 1.

funny enough, downgrading seems to not fix it, I guess I borked something

Stanzilla avatar Jul 22 '25 21:07 Stanzilla

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment, or this will be closed in 30 days.

github-actions[bot] avatar Aug 22 '25 00:08 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Sep 21 '25 00:09 github-actions[bot]