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

Can not build the windows installer on macOS Catalina version 10.15 #4305

Closed
lingxf2002 opened this issue Oct 9, 2019 · 39 comments
Closed

Can not build the windows installer on macOS Catalina version 10.15 #4305

lingxf2002 opened this issue Oct 9, 2019 · 39 comments
Labels

Comments

@lingxf2002
Copy link

@lingxf2002 lingxf2002 commented Oct 9, 2019

• electron-builder version=21.2.0 os=19.0.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist/builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=6.0.12 appOutDir=dist/win-unpacked
• signing file=dist/win-unpacked/BUZZ.exe certificateFile=/Users/xling/buzzcodesigning/dialogic2018.pfx
• building target=nsis file=dist/buzz-installer-4.1.0.exe archs=x64 oneClick=true perMachine=false
• signing file=dist/win-unpacked/resources/elevate.exe certificateFile=/Users/xling/buzzcodesigning/dialogic2018.pfx
⨯ Exit code: ENOENT. spawn prlctl ENOENT stackTrace=
Error: Exit code: ENOENT. spawn prlctl ENOENT
at /Users/xling/workspace/git_bit/main/buzz_desktop/electron_app/node_modules/builder-util/src/util.ts:125:16
at exithandler (child_process.js:295:5)
at ChildProcess.errorhandler (child_process.js:307:5)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:236:12)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)

@pashvin

This comment has been minimized.

Copy link

@pashvin pashvin commented Oct 9, 2019

I think to build Windows app you need Window machine and to build mac app you need Mac machine.

@lingxf2002

This comment has been minimized.

Copy link
Author

@lingxf2002 lingxf2002 commented Oct 9, 2019

it works on older macOS

@jsgv

This comment has been minimized.

Copy link

@jsgv jsgv commented Oct 9, 2019

@pashvin I have been able to build Windows apps on my macOS until the Catalina update.

@ukmarn

This comment has been minimized.

Copy link

@ukmarn ukmarn commented Oct 10, 2019

Same here.. Worked fine till Catalina update, now throwing same error as above.

@jsgv

This comment has been minimized.

Copy link

@jsgv jsgv commented Oct 10, 2019

Catalina removed support for 32 bit apps (you can still create 64 bit builds).
I have to do my builds on a Window VM because of this.

@jsgv

This comment has been minimized.

@lingxf2002

This comment has been minimized.

Copy link
Author

@lingxf2002 lingxf2002 commented Oct 10, 2019

@jsgv Can not build with 64 bit either.
electron-builder version=21.2.0 os=19.0.0
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist/builder-effective-config.yaml
• packaging platform=win32 arch=x64 electron=6.0.12 appOutDir=dist/win-unpacked
• signing file=dist/win-unpacked/BUZZ.exe certificateFile=/Users/xling/buzzcodesigning/dialogic2018.pfx
• building target=nsis file=dist/buzz-installer-4.1.0.exe archs=x64 oneClick=true perMachine=false
• signing file=dist/win-unpacked/resources/elevate.exe certificateFile=/Users/xling/buzzcodesigning/dialogic2018.pfx
⨯ Exit code: ENOENT. spawn prlctl ENOENT stackTrace=
Error: Exit code: ENOENT. spawn prlctl ENOENT
at /Users/xling/workspace/git_bit/main/buzz_desktop/electron_app/node_modules/builder-util/src/util.ts:125:16
at exithandler (child_process.js:295:5)
at ChildProcess.errorhandler (child_process.js:307:5)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:236:12)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)

@stevenroussey-privicy

This comment has been minimized.

Copy link

@stevenroussey-privicy stevenroussey-privicy commented Oct 11, 2019

You are building for win64, but the the software used to emulate windows on mac is called wine, and wine is 32bit.

@jianfenkezhan

This comment has been minimized.

Copy link

@jianfenkezhan jianfenkezhan commented Oct 11, 2019

how to fix?

@wkoncki

This comment has been minimized.

Copy link

@wkoncki wkoncki commented Oct 11, 2019

You are building for win64, but the the software used to emulate windows on mac is called wine, and wine is 32bit.

That's a real bummer. I hoped to at least be able to build Windows x64 releases from macOS. Wine itself comes in x64 variant but it must use some 32 bit libraries that are not working on Catalina anymore. I guess I have to get VirtualBox going again.

@thaddeusm

This comment has been minimized.

Copy link

@thaddeusm thaddeusm commented Oct 11, 2019

I was able to use Docker with the info provided in the docs to build a Windows (NSIS) release from my Mac (running Catalina). It was my first time using Docker. I am amazed.

For convenience, the Docker script provided in the docs is as follows:

docker run --rm -ti \
 --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
 --env ELECTRON_CACHE="/root/.cache/electron" \
 --env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" \
 -v ${PWD}:/project \
 -v ${PWD##*/}-node-modules:/project/node_modules \
 -v ~/.cache/electron:/root/.cache/electron \
 -v ~/.cache/electron-builder:/root/.cache/electron-builder \
 electronuserland/builder:wine

For my use case, I decided to separate release scripts for each platform my app supports (Mac and Windows) because I ran into a problem building a DMG from the Docker container. Instead, I can use the image above just to build and publish my Windows builds.

After having previously relied upon 32-bit Wine, which always seemed less polished, I am thoroughly impressed with this new solution. For reference, my project is here.

UPDATE: Fixed the formatting issue. Thanks @agrublev

@agrublev

This comment has been minimized.

Copy link

@agrublev agrublev commented Oct 16, 2019

I was able to use Docker with the info provided in the docs to build a Windows (NSIS) release from my Mac (running Catalina). It was my first time using Docker. I am amazed.

For convenience, the Docker script provided in the docs is as follows:

docker run —rm -ti \ —env-file <(env | grep -iE ‘DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_’) \ —env ELECTRON_CACHE=“/root/.cache/electron” \ —env ELECTRON_BUILDER_CACHE=“/root/.cache/electron-builder” \ -v ${PWD}:/project \ -v ${PWD##*/}-node-modules:/project/node_modules \ -v ~/.cache/electron:/root/.cache/electron \ -v ~/.cache/electron-builder:/root/.cache/electron-builder \ electronuserland/builder:wine

For my use case, I decided to separate release scripts for each platform my app supports (Mac and Windows) because I ran into a problem building a DMG from the Docker container. Instead, I can use the image above just to build and publish my Windows builds.

After having previously relied upon 32-bit Wine, which always seemed less polished, I am thoroughly impressed with this new solution. For reference, my project is here.

For those who try to copy your improperly formatted comment

docker run --rm -ti \
 --env-file <(env | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
 --env ELECTRON_CACHE="/root/.cache/electron" \
 --env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" \
 -v ${PWD}:/project \
 -v ${PWD##*/}-node-modules:/project/node_modules \
 -v ~/.cache/electron:/root/.cache/electron \
 -v ~/.cache/electron-builder:/root/.cache/electron-builder \
 electronuserland/builder:wine
@rajjagani021

This comment has been minimized.

Copy link

@rajjagani021 rajjagani021 commented Nov 10, 2019

@thaddeusm

Hi I am new to docker and I have created an account and install the docker and all but can you please provide me the steps that I need to after that?

@thaddeusm

This comment has been minimized.

Copy link

@thaddeusm thaddeusm commented Nov 10, 2019

@rajjagani021

After installing Docker, you should run the application on your computer. Then, in your terminal, you can paste the script above. That will get a Docker container configured with the environment needed to package your Electron app. From there, you can run the script you have defined in your app's package.json file to build your application.

Electron Builder accepts flags to identify the target (e.g. "-w" as Windows).

@mengyingdu

This comment has been minimized.

Copy link

@mengyingdu mengyingdu commented Nov 12, 2019

when i went to the second step : yarn & yarn electron-builder -w

Why it pop up this error: Command "electron-builder" not found.

develar added a commit that referenced this issue Nov 27, 2019
@lutzroeder

This comment has been minimized.

Copy link
Contributor

@lutzroeder lutzroeder commented Nov 27, 2019

electron-builder 22.2.0 now includes a targeted workaround extracting the NSIS uninstaller without the need to spin up Parallels or wine. Can you give this a try and report if it works? Not just building the installer on Catalina but also if running uninstall on Windows works.

@develar develar closed this Nov 27, 2019
@develar

This comment has been minimized.

Copy link
Member

@develar develar commented Nov 27, 2019

I need to say that it is miracle. I couldn't even imagine that it will be fixed (because Windows is not OS). Thanks to @lutzroeder .

@eliasaviatrix

This comment has been minimized.

Copy link

@eliasaviatrix eliasaviatrix commented Nov 27, 2019

electron-builder 22.2.0 now includes a targeted workaround extracting the NSIS uninstaller without the need to spin up Parallels or wine. Can you give this a try and report if it works? Not just building the installer on Catalina but also if running install and uninstall on Windows.

It works for me.

@Zophyr

This comment has been minimized.

Copy link

@Zophyr Zophyr commented Nov 29, 2019

electron-builder 22.2.0 now includes a targeted workaround extracting the NSIS uninstaller without the need to spin up Parallels or wine. Can you give this a try and report if it works? Not just building the installer on Catalina but also if running install and uninstall on Windows works.

It works for me! Thank you!

@rajjagani021

This comment has been minimized.

Copy link

@rajjagani021 rajjagani021 commented Nov 30, 2019

electron-builder 22.2.0 now includes a targeted workaround extracting the NSIS uninstaller without the need to spin up Parallels or wine. Can you give this a try and report if it works? Not just building the installer on Catalina but also if running install and uninstall on Windows works.

It works for me too! Thank you

@ttomaszewski

This comment has been minimized.

Copy link

@ttomaszewski ttomaszewski commented Dec 1, 2019

I downloaded 22.2.0 to build the Windows installer. My build script works but I am not able to install the built .exe.
Install gets hung up.
install

I have no trouble installing when downgrading back to 21.2.0.

AndreiSoroka added a commit to AndreiSoroka/vue-cli-plugin-electron-builder that referenced this issue Dec 1, 2019
@lutzroeder

This comment has been minimized.

Copy link
Contributor

@lutzroeder lutzroeder commented Dec 1, 2019

@ttomaszewski this change should not impact how the installer is built.

  1. Can you open ./node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js, replace _nsisUtil().UninstallerReader.exec(installerPath, uninstallerPath); with throw new Error("Test"); and rebuild from scratch. This will always fall back to the Parallels code path.
  2. Is there anything specific about your NSIS build? Can you share the project or steps to reproduce the issue?
@JonathanLee-LX

This comment has been minimized.

Copy link

@JonathanLee-LX JonathanLee-LX commented Dec 11, 2019

electron-builder 22.2.0 now includes a targeted workaround extracting the NSIS uninstaller without the need to spin up Parallels or wine. Can you give this a try and report if it works? Not just building the installer on Catalina but also if running install and uninstall on Windows works.

you save my day

@HemalR

This comment has been minimized.

Copy link

@HemalR HemalR commented Dec 12, 2019

Worked for me, thanks!

Installer exe has doubled in size though, I wonder if that's related?

@ttomaszewski

This comment has been minimized.

Copy link

@ttomaszewski ttomaszewski commented Dec 12, 2019

@HemalR I noticed exe doubled as well when running multi platform build (dmg and exe). I also still have issue where app fails to launch after installing exe. I mentioned in above comments. Running script to build mac and win separately resolves issue but would be nice to only have to run once.

@psiservices-ccounterman

This comment has been minimized.

Copy link

@psiservices-ccounterman psiservices-ccounterman commented Dec 12, 2019

The binary
~/Library/Caches/electron-builder/nsis/nsis-3.0.4.1/mac/makensis
from
https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-3.0.4.1/nsis-3.0.4.1.7z

doesn't work on my macOS 10.13, fails with:

dyld: lazy symbol binding failed: Symbol not found: ____chkstk_darwin
Referenced from: /Users/ccounterman/Library/Caches/electron-builder/nsis/nsis-3.0.4.1/mac/makensis (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib

@lutzroeder

This comment has been minimized.

Copy link
Contributor

@lutzroeder lutzroeder commented Dec 12, 2019

@HemalR @ttomaszewski can you try the steps mentioned above:

  1. Open ./node_modules/app-builder-lib/out/targets/nsis/NsisTarget.js
  2. Replace _nsisUtil().UninstallerReader.exec(installerPath, uninstallerPath); with throw new Error("Test");
  3. Rebuild from scratch.

This will always fall back to the Parallels code path on Catalina.

Try building with this change and without this change. If the binaries are not identical it might be related to uninstaller extraction and an actual repro project would be helpful...

@HemalR

This comment has been minimized.

Copy link

@HemalR HemalR commented Dec 14, 2019

@lutzroeder
Just did the test you've set out. It threw an error and failed to build entirely:

• packager.vm is used: Test
  ⨯ Exit code: ENOENT. spawn prlctl ENOENT  stackTrace=
                                                        Error: Exit code: ENOENT. spawn prlctl ENOENT
                                                            at /Users/hemal/repos/mediref-desktop/node_modules/builder-util/src/util.ts:125:16
                                                            at exithandler (child_process.js:302:5)
                                                            at ChildProcess.errorhandler (child_process.js:314:5)
                                                            at ChildProcess.emit (events.js:210:5)
                                                            at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
                                                            at onErrorNT (internal/child_process.js:456:16)
                                                            at processTicksAndRejections (internal/process/task_queues.js:80:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mediref-desktop@0.2.5 pack_windows: `electron-builder --win --x64 --ia32`
npm ERR! Exit status 1

Here is the repo in question: https://github.com/HemalR/mediref-desktop

Ps - Thanks for taking the time to help!

@lutzroeder

This comment has been minimized.

Copy link
Contributor

@lutzroeder lutzroeder commented Dec 14, 2019

@HemalR Exit code: ENOENT. spawn prlctl ENOENT is the error that started this thread. On Catalina, 32-bit apps like wine are no longer supported and to extract the Windows NSIS uninstaller in electron-builder it is required to install a Windows VM in Parallels. The workaround added to resolve this is extracting the uninstaller without wine or Parallels. With the workaround removed, a Parallels VM, Windows machine or pre-Catalina macOS is required to build "the old way" for comparison.

git clone https://github.com/HemalR/mediref-desktop && cd mediref-desktop && npm install
npx electron-builder --win
~/Projects/mediref-desktop: ls -la ./dist/*.exe
[...] 44589377 [...] ./dist/Mediref Setup 0.2.5.exe

~45 MB is normal for an Electron app?

@HemalR

This comment has been minimized.

Copy link

@HemalR HemalR commented Dec 14, 2019

Doh! Let me take a crack at spinning up a Windows Machine on Azure and seeing how it builds on there

@HemalR

This comment has been minimized.

Copy link

@HemalR HemalR commented Dec 14, 2019

Test done:

Right, building the installer on Windows = 88MB
Same installer on Mac = 149MB

So the binaries are not identical. I'm happy to do any grunt work to help figure this out/do any further testing.

Regarding Electron size in general - I know electron apps are huge (a consequence of all the functionality shipped with them, whether used or not). My one has an additional pdf reader that bloats it by a further 25ish MB.

@lutzroeder

This comment has been minimized.

Copy link
Contributor

@lutzroeder lutzroeder commented Dec 14, 2019

@HemalR I ran the 3 commands above on macOS and got a 45 MB installer?

@HemalR

This comment has been minimized.

Copy link

@HemalR HemalR commented Dec 14, 2019

I'm lost for explanations 😕

I set up a new project (using my own repo) and the instructions as you did and got the same results as you. Why the discrepancy with my original project, I have no idea. 😕

Edit - Did some more testing (on the new repo vs the old one)

The build command causing the big builds is:

electron-builder --win --x64 --ia32

Vs

electron-builder --win

I don't know what exactly the difference is nor its significance.

Another point of note is that on the new test repo, the 'bigger' build is 86.6MB vs 149MB on the original - and I don't even have a suspicion about why that would be.

@lutzroeder

This comment has been minimized.

Copy link
Contributor

@lutzroeder lutzroeder commented Dec 14, 2019

@HemalR 7z l "Setup x.x.x.exe" can help poking around. Guess would be that 86.6 MB contains both 32 and 64 bit files as it is ~ twice 45 MB. You should create a new ticket if this is not related to the Catalina uninstaller issue (which would only impact the size of the uninstaller).

@HemalR

This comment has been minimized.

Copy link

@HemalR HemalR commented Dec 14, 2019

Yup agreed, not related.

@lutzroeder Thanks a lot for the help (and for the Catalina fix). Much appreciated 👍

@Faksprod

This comment has been minimized.

Copy link

@Faksprod Faksprod commented Dec 16, 2019

@lutzroeder Many thanks for the tips about electron-builder 22.2.0! It works for me too but ONLY using NON programmatic-usage for building/signing an APPX. In April 2019, I had to use programmatic-usage for building apps instead of using the standard package.json method because of this issue. So today I just moved back to the normal package.json method and building my APPX from MacOS Catalina worked well thanks to electron-builder 22.2.0. Thanks!

@gudqs7

This comment has been minimized.

Copy link

@gudqs7 gudqs7 commented Dec 17, 2019

electron-builder 22.2.0 now includes a targeted workaround extracting the NSIS uninstaller without the need to spin up Parallels or wine. Can you give this a try and report if it works? Not just building the installer on Catalina but also if running uninstall on Windows works.

Good for me

@j-mcnally

This comment has been minimized.

Copy link

@j-mcnally j-mcnally commented Dec 26, 2019

I'm lost for explanations 😕

I set up a new project (using my own repo) and the instructions as you did and got the same results as you. Why the discrepancy with my original project, I have no idea. 😕

Edit - Did some more testing (on the new repo vs the old one)

The build command causing the big builds is:

electron-builder --win --x64 --ia32

Vs

electron-builder --win

I don't know what exactly the difference is nor its significance.

Another point of note is that on the new test repo, the 'bigger' build is 86.6MB vs 149MB on the original - and I don't even have a suspicion about why that would be.

Isn’t ia32 a separate architecture ?

@wkoncki

This comment has been minimized.

Copy link

@wkoncki wkoncki commented Dec 26, 2019

Isn’t ia32 a separate architecture ?

I'm 99% sure that electron by default builds only x64, not ia32, so it's expected that build for two architectures will be around twice in size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.