Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get this error message when I build the app: Error: Exit code: EACCES. spawn filename.exe EACCES #5575

Closed
janosvajda opened this issue Jan 23, 2021 · 2 comments · Fixed by #6013

Comments

@janosvajda
Copy link

janosvajda commented Jan 23, 2021

  • Version: 22.2.0
  • Electron Version: 10.3.0
  • Electron Type (current, beta, nightly): current
  • Target: windows

Hi,

I got this error message if I try to build the app:

Error: Exit code: EACCES. spawn filename.exe EACCES
    at ....\node_modules\builder-util\src\util.ts:129:16
    at exithandler (child_process.js:315:5)
    at ChildProcess.errorhandler (child_process.js:327:5)
    at ChildProcess.emit (events.js:315:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    at onErrorNT (internal/child_process.js:465:16)

I use NSIS and this error occurs if I have this line in the NSIS file:


!macro customHeader
   RequestExecutionLevel admin
!macroend

My package.json contains these related values:

win: {
          icon: "public/icons/icon.ico",
          target: "nsis",
          requestedExecutionLevel: "requireAdministrator"
          ......

I tried this under Parallel Windows 10, Oracle VM Windows 10, and native Windows 10, and this issue exists under each of them.

Thanks for any assistance.

@janosvajda
Copy link
Author

It solved.

If Windows console is running in Administrator mode then no errors and it works fine.

@mook-as
Copy link
Contributor

mook-as commented Apr 30, 2021

Hi! I've hit this too. Writing my notes here because this was the best hit in the issues, and I'll probably hit this again later.

This appears to be because electron-builder will run the just-generated installer in order to get the uninstaller, so that it can be signed. This behaviour was originally introduced in #526, following instructions from the NSIS wiki.

The better workaround is to set __COMPAT_LAYER=RunAsInvoker in the environment before running NSIS; this forces everything to run unelevated, which means that the installer can generate the uninstaller to be signed.

mmaietta pushed a commit that referenced this issue Jul 5, 2021
* fix(builder-util): fix how env is passed to child processes
* fix(nsis): generate uninstaller without elevating
Signing the uninstaller requires generating and running the stub, which can break the build due to requiring admin rights for any elevated-installer. Setting env var to request Windows to ignore the embedded manifest will always run the stub installer as the invoker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants