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

Not building on M1 mac with Monterey #1691

Closed
spuky opened this issue Mar 10, 2022 · 3 comments
Closed

Not building on M1 mac with Monterey #1691

spuky opened this issue Mar 10, 2022 · 3 comments

Comments

@spuky
Copy link

spuky commented Mar 10, 2022

Describe the bug
apple removed python 3 support which prevents bundeling the dmg
see electron-userland/electron-builder#6617

fixed in electron-builder v23

To Reproduce
Steps to reproduce the behavior:

try building an mac app

Expected behavior

app builds without error

Additional context

for People running into this here is a workaround:

EDIT: Workarround is not needed
just add
"vue-cli-plugin-electron-builder": "git://github.com/spuky/vue-cli-plugin-electron-builder#b6826fc",
to your package.json to install with upgraded dependency

add a .env file to your project with your Python 3 location:

PYTHON_PATH=/opt/homebrew/bin/python3

gets rid of the first error:

Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT

then edit core.py the file in the sceond error (might be in node_modules/electron-builder or node_modules/vue-cli-plugin-electron-builder depending on the fact if you tried upgrading electron builder yourself..) you run into

Error: Exit code: 1. Command failed: /opt/homebrew/bin/python3 /Users/spuky/webstuff/myproject/node_modules/electron-builder/node_modules/dmg-builder/vendor/dmgbuild/core.py
Traceback (most recent call last):
File "/Users/spuky/webstuff/myproject/node_modules/electron-builder/node_modules/dmg-builder/vendor/dmgbuild/core.py", line 7, in
reload(sys) # Reload is a hack
NameError: name 'reload' is not defined

to read like this:

`# -- coding: utf-8 --
from future import unicode_literals

import os
import re
import sys
from importlib import reload
reload(sys) # Reload is a hack
#sys.setdefaultencoding('UTF8')`

new stuff is
from importlib import reload
and the comented
sys.setdefaultencoding('UTF8')
line...

then your app should build...

Resolution:

Bumping the dependency of electron-builder to v23 should fix the issue..

@spuky
Copy link
Author

spuky commented Mar 10, 2022

just added a pullrequest anybody with this issue can add

"vue-cli-plugin-electron-builder": "git://github.com/spuky/vue-cli-plugin-electron-builder#b6826fc",

as a depency in his package.json to get working again no need for python path in env no changeing files..

@rankill
Copy link

rankill commented Sep 14, 2022

Is there any update on this issue? I cannot build for in my MacBook M1

@MatthijsBurgh
Copy link
Collaborator

The default branch of this repo, does depend on electron-builder v23. It isn't released yet and this might still take some time.

sunner added a commit to ai-shifu/ChatALL that referenced this issue Apr 10, 2023
But acturally, it doesn't work on macOS now. According to github
issue,the bug would be fixed by offical team.

nklayman/vue-cli-plugin-electron-builder#1691
undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue Jul 31, 2023
The GitHub-hosted runners began experiencing issues while building macOS
desktop distributions, exclusively affecting the macOS environment.
The Ubuntu and Windows environments remained unaffected.

The logs highlighted the absence of Python in the macOS environment, which
resulted in build failure:

```sh
  Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

Since the `electron-builder` package uses Python scripts to create DMG
disk images for macOS distributions, Python is needed for building the
application. However, electron-builder uses Python 2.X meanwhile modern
macOS versions have removed Python 2.X from the operating system on
default installation.

Although this issue was resolved in `electron-builder` version 23,,
`vue-cli-plugin-electron-builder` continues to use version 22. Due to a
lack of maintenance, the package is unlikely to receive updates.

This commit forces `vue-cli-plugin-electron-builder` to use the latest
`electron-builder` which resolves the macOS distribution build failure.

In CI process, GitHub-hosted runners start to fail when building macOS
desktop distributions. It is only observered in the macOS environment
while the application is built successfully in both the Ubuntu and
Windows environments.

The error message in the logs indicated that Python was not found in the
macOS environment:

```sh
Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

`electron-builder` package uses Python scripts for certain operations,
specifically for creating DMG disk images for macOS distributions. As a
result, Python is a necessary dependency when building the application
for macOS.

`electron-builder` has fixed this starting from version 23, but
vue-cli-plugin-electron-builder still refers to version 22 and it is
unmaintained and not likely to get updates.

The solution is to add a step in the GitHub Actions workflow to set up
Python in the macOS environment. `actions/setup-python` sets up the
Python environment in the runner if the OS is macOS.

This change does not impact the Ubuntu and Windows environments as the
setup-python step is conditionally executed only for macOS. The addition
of Python to the macOS environment in CI process has resolved the build
failure issue for the macOS distribution.

See also:

- electron-userland/electron-builder#6606
- electron-userland/electron-builder#6726
- electron-userland/electron-builder#6732
- nklayman/vue-cli-plugin-electron-builder#1691
- nklayman/vue-cli-plugin-electron-builder#1701
LarrMarburger added a commit to LarrMarburger/privacy.sexy that referenced this issue Nov 16, 2023
The GitHub-hosted runners began experiencing issues while building macOS
desktop distributions, exclusively affecting the macOS environment.
The Ubuntu and Windows environments remained unaffected.

The logs highlighted the absence of Python in the macOS environment, which
resulted in build failure:

```sh
  Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

Since the `electron-builder` package uses Python scripts to create DMG
disk images for macOS distributions, Python is needed for building the
application. However, electron-builder uses Python 2.X meanwhile modern
macOS versions have removed Python 2.X from the operating system on
default installation.

Although this issue was resolved in `electron-builder` version 23,,
`vue-cli-plugin-electron-builder` continues to use version 22. Due to a
lack of maintenance, the package is unlikely to receive updates.

This commit forces `vue-cli-plugin-electron-builder` to use the latest
`electron-builder` which resolves the macOS distribution build failure.

In CI process, GitHub-hosted runners start to fail when building macOS
desktop distributions. It is only observered in the macOS environment
while the application is built successfully in both the Ubuntu and
Windows environments.

The error message in the logs indicated that Python was not found in the
macOS environment:

```sh
Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
```

`electron-builder` package uses Python scripts for certain operations,
specifically for creating DMG disk images for macOS distributions. As a
result, Python is a necessary dependency when building the application
for macOS.

`electron-builder` has fixed this starting from version 23, but
vue-cli-plugin-electron-builder still refers to version 22 and it is
unmaintained and not likely to get updates.

The solution is to add a step in the GitHub Actions workflow to set up
Python in the macOS environment. `actions/setup-python` sets up the
Python environment in the runner if the OS is macOS.

This change does not impact the Ubuntu and Windows environments as the
setup-python step is conditionally executed only for macOS. The addition
of Python to the macOS environment in CI process has resolved the build
failure issue for the macOS distribution.

See also:

- electron-userland/electron-builder#6606
- electron-userland/electron-builder#6726
- electron-userland/electron-builder#6732
- nklayman/vue-cli-plugin-electron-builder#1691
- nklayman/vue-cli-plugin-electron-builder#1701
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

No branches or pull requests

3 participants