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

ERR_ELECTRON_BUILDER_CANNOT_EXECUTE

Open MisterOryon opened this issue 3 years ago • 37 comments

I come to you because after several days of research I did not manage to correct this problem, when i try to create an nsis installer. you will find attached my json file is the error. if anyone has an answer to my problem please help me please.

node: v12.18.2 npm: 6.14.5

{ "name": "electron-quick-start", "version": "2.0.0", "description": "A minimal Electron application", "main": "main.js", "repository": { "type": "git", "url": "git+https://github.com" }, "keywords": [ "Electron" ], "author": "GitHub", "license": "CC0-1.0", "devDependencies": { "electron": "^9.1.0", "electron-builder": "^22.0.0" }, "scripts": { "start": "electron .", "pack": "electron-builder --dir", "dist": "electron-builder" }, "build": { "appId": "yourappid", "win": { "target": "NSIS" } } }

electron-builder version=22.7.0 os=10.0.19041 • loaded configuration file=package.json ("build" field) • writing effective config file=dist\builder-effective-config.yaml • packaging platform=win32 arch=x64 electron=9.1.0 appOutDir=dist\win-unpacked • default Electron icon is used reason=application icon is not set • building target=nsis file=dist\electron-quick-start Setup 1.0.0.exe archs=x64 oneClick=true perMachine=false ⨯ C:\Users\C******_M*******\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE Output:

MisterOryon avatar Jul 08 '20 22:07 MisterOryon

Have the same issue here, I need to downgrade to 21.2.0

EdmarPereira avatar Jul 13 '20 22:07 EdmarPereira

even with electron-builder version = 21.2.0 the problem persists

Error: C:\Users\M******_C******\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.3.2\Bin\makensis.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE at ChildProcess. (H:\SaveLane\node_modules\builder-util\src\util.ts:239:14) at Object.onceWrapper (events.js:422:26) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

MisterOryon avatar Jul 14 '20 12:07 MisterOryon

I had the same issue, I moved my app folder to the root of my hard-drive, and it worked. Electron-builder does not seem to be supporting non-ASCII characters in the path of an app.

Eole7 avatar Jul 19 '20 18:07 Eole7

unfortunately the problem still persists.

MisterOryon avatar Jul 19 '20 22:07 MisterOryon

@Eole7 Care to elaborate your solution? I am running into the same issue, not very helpful for my CI.

Wensh avatar Jul 22 '20 20:07 Wensh

@Eole7 Care to elaborate your solution? I am running into the same issue, not very helpful for my CI.

Well, if you're running the same issue on your CI, my solution might not help you, as I don't have this issue on my CI. Though, the issue I have on local is that when I add the LICENSE key (but from what I've read on other issues, it could be for other reasons) to my NSIS build parameters and that the path of my app contains non-ASCII characters, I get the above error. I moved my app folder to the root directory of my drive and the build was successful.

Eole7 avatar Jul 23 '20 16:07 Eole7

I had the same problem but only when trying to brand our product with electron-builder in a linux Debian Buster docker container

The solution that we ended up needing is install wine and wine32 for i386 arch

node: v10.15.3 npm: 6.4.1 electron-builder: 22.8.0

we simple added these commands to our Dockerfile:

 + dpkg --add-architecture i386 && \
    apt-get update && \
    apt-get install <LONG_LIST_OF_PACKAGES_WE_NEED> && \
+  apt-get install wine wine32

The part about needing the wine framework is also detailed in the official docs

samermurad avatar Sep 01 '20 15:09 samermurad

This error may also appear when you're trying to build the app while some electron process is running (e.g. after improperly closing the dev server).

Open your task manager and make sure you don't have any running electron processes.

aleksey-hoffman avatar Sep 19 '20 00:09 aleksey-hoffman

Same here. Above comments are looking not related to my case. I don't know what is wrong.

Hadatko avatar Oct 02 '20 13:10 Hadatko

Solved: in my case svg app icon did the issue:

"build": {
        "compression": "store",
        "asar": "true",
        "win": {
            "target": "portable",
            "icon": "./html/img/logo.svg",
            "files": ["**/*", "!html/measurements/*"]
        },
        "directories": {
            "app": "."
        }
    }

Hadatko avatar Oct 02 '20 14:10 Hadatko

Under Linux it cannot be even jpg as i did for windows. It has to be png.

Hadatko avatar Oct 02 '20 14:10 Hadatko

same here, issue was missing icon key in build.linux

gocarlos avatar Oct 12 '20 08:10 gocarlos

Yeah, if you look further down the output there should be a more descriptive error. Mine was

Error while loading icon from "C:\...\resources\uninstallerIcon.ico": invalid icon file

I was able to fix it by opening the image in GIMP and re-saving it.

ntbosscher avatar Oct 29 '20 15:10 ntbosscher

Same for me, wrong icon path. Got to say electron-builder error reporting is quite awful.

laurent22 avatar Nov 05 '20 19:11 laurent22

这里比较详细:https://juejin.cn/post/6901564623091138567/

spcBackToLife avatar Dec 02 '20 07:12 spcBackToLife

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Feb 02 '21 04:02 stale[bot]

Still relevant. A missing icon shouldn't produce an unrelated "ERR_ELECTRON_BUILDER_CANNOT_EXECUTE" which is impossible to debug.

laurent22 avatar Feb 02 '21 10:02 laurent22

On GitHub actions I am getting the following error:

electron-builder install-app-deps

  • electron-builder  version=22.9.1
  • loaded configuration  file=package.json ("build" field)
  ⨯ node_modules.Dependency.Dependencies: ReadMapCB: expect { or n, but found [, error found in #10 byte of ...|ncies" : [],
	"main|..., bigger context ...|/garycourt/JSV.git"
		}
	],
	"dependencies" : [],
	"main" : "lib/jsv.js",
	"keywords" : ["json"|...
Error reading package.json: /home/runner/work/arc-electron/arc-electron/node_modules/JSV/package.json  
  ⨯ /home/runner/work/arc-electron/arc-electron/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
                                                                                                                                                           Error: /home/runner/work/arc-electron/arc-electron/node_modules/app-builder-bin/linux/x64/app-builder exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
                                                                                                                                                               at ChildProcess.<anonymous> (/home/runner/work/arc-electron/arc-electron/node_modules/builder-util/src/util.ts:243:14)
                                                                                                                                                               at Object.onceWrapper (events.js:422:26)
                                                                                                                                                               at ChildProcess.emit (events.js:315:20)
                                                                                                                                                               at maybeClose (internal/child_process.js:1048:16)
                                                                                                                                                               at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)

It looks like a file is not being properly read? Not sure why this error is thrown.

jarrodek avatar Feb 04 '21 20:02 jarrodek

getting the same error, no clue what the cause is

FrancescoBorzi avatar Feb 24 '21 17:02 FrancescoBorzi

@jarrodek please open a separate issue, EB error reporting is certainly bad and your error code is indeed the same, but the issues should probably be triaged separately.

@FrancescoBorzi not sure which error you're referring to. Is it related to icons? GitHub actions? Please elaborate when you have a chance 🙂

mmaietta avatar Feb 25 '21 16:02 mmaietta

@jarrodek please open a separate issue, EB error reporting is certainly bad and your error code is indeed the same, but the issues should probably be triaged separately.

@FrancescoBorzi not sure which error you're referring to. Is it related to icons? GitHub actions? Please elaborate when you have a chance 🙂

I'm getting the same error as the title of this issue report ERR_ELECTRON_BUILDER_CANNOT_EXECUTE when trying to build my app locally.

My app is: https://github.com/azerothcore/Keira3

reproduction steps: clone the repo, npm install then npm run electron:mac (replace mac with windows or linux accordingly).

Do I need to open a separate issue for that?

FrancescoBorzi avatar Feb 26 '21 09:02 FrancescoBorzi

Same here for https://github.com/blockstack/stacks-wallet/runs/1987721517

kyranjamie avatar Feb 26 '21 13:02 kyranjamie

I ran into this error as well. Turned out that it didn't like that I had nvm installed (which had somehow caused a weird state where my global npm was missing and I'd needed to install it with yarn). Removing nvm and reinstalling node fixed it for me.

buu700 avatar Mar 27 '21 02:03 buu700

For me the issue was the high resolution of the icns file for the mac icon (1024x1024), and not having specified an icon for the linux build. For the linux version I added a 512x512.png and added it to the linux config, that solved the issue for me.

matthijsgroen avatar Apr 10 '21 11:04 matthijsgroen

I had this trouble today. I used the below command for packaging app in package.json

"deploy:win32": npx electron-builder --config ./build/scripts/win32/build-win32.yml

After some tries, I've got the fact I was using the global npm's electron-builder, so I changed the command like below :

"deploy:win32": "./node_modules/.bin/electron-builder --config ./build/scripts/win32/build-win32.yml",

It works fine now anyway.

walrus811 avatar May 11 '21 08:05 walrus811

For me, the cause was using a monorepo in which the package name was @whatever/subrepo on package.json.

For the linux build, the executable name is taken from there. So the fix for me was

linux: {
          executableName: 'simple-name',
        },

beliolfa avatar May 26 '21 16:05 beliolfa

For me It was because of the last build process I've terminated with CTRL + C.

This was the error code I was getting.

Error output:
Bad text encoding: uninstaller.nsh:1
!include: error in script: "uninstaller.nsh" on line 1
Error in script "<stdin>" on line 165 -- aborting creation process

The solution is just re-install the electron-builder.

npm uninstall electron-builder -g
npm install electron-builder -g --save-dev

tarik0 avatar Jun 11 '21 22:06 tarik0

I was having the same problem. Apparently electron-builder does blind copy without checking if directories in target path exist and doesn't even try to create them, which raises the exception. I created all the non-existing directories in target path [/resources] so that it can copy and it worked.

xadk avatar Aug 08 '21 11:08 xadk

For me npm exec electron-builder ... worked inside the package.json scripts

phanirithvij avatar Oct 13 '21 05:10 phanirithvij

If you run npx electron-builder, electron-builder will mistakenly use npx as a package manager and try to use it to install dependencies.

alex-kinokon avatar Nov 05 '21 06:11 alex-kinokon