apache / apache/cordova-electron

Build failing on M1 macOS Ventura 13.5.2

Open
#258 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
135
Forks
60
Avg merge
1d 6h
Merged PRs (30d)
5

Description

# Bug Report

## Problem
Plain vanilla Cordova electron project fails `cordova build electron` with the dreaded ENOENT error (ref. earlier error: https://github.com/apache/cordova-electron/issues/220 --> marked as fixed).

### What is expected to happen?
Successful build

### What does actually happen?
Looks like it's still looking for python in the wrong place.

## Information
Was trying to build an existing project on the electron platform (I think this was working on a previous OS / chipset IIRC) and running into this same error, so I tried the basic steps on a new project (https://cordova.apache.org/#getstarted):
`cordova create tmpElectron`
`cd tmpElectron`
`cordova platform add electron`
`cordova build electron --verbose`

output from the build:

```
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking for saved platforms that haven't been added to the project
Loaded API for electron project /Users/erik/dev/tmpElectron/platforms/electron/cordova/Api.js
Checking for saved plugins that haven't been added to the project
Generating config.xml from defaults for platform "electron"
Merging and updating files from [www, platforms/electron/platform_www] to platforms/electron/www
copy platforms/electron/platform_www/cdv-electron-settings.json platforms/electron/www/cdv-electron-settings.json (updated file)
copy platforms/electron/platform_www/config.xml platforms/electron/www/config.xml (updated file)
delete platforms/electron/www/manifest.json (no source)
This app does not have icons defined
This app does not have splash screens defined.
Creating new manifest file in => undefined
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
• electron-builder version=22.14.13 os=22.6.0
• writing effective config file=platforms/electron/build/builder-effective-config.yaml
• packaging platform=darwin arch=x64 electron=14.2.9 appOutDir=platforms/electron/build/mac
• signing file=platforms/electron/build/mac/HelloCordova.app identityName=Developer ID Application: [snip -- it's me, I'm the developer]
• building target=DMG arch=x64 file=platforms/electron/build/HelloCordova-1.0.0.dmg
• building target=macOS zip arch=x64 file=platforms/electron/build/HelloCordova-1.0.0-mac.zip
• Detected arm64 process, HFS+ is unavailable. Creating dmg with APFS - supports Mac OSX 10.12+
• building block map blockMapFile=platforms/electron/build/HelloCordova-1.0.0-mac.zip.blockmap
Exit code: ENOENT. spawn /usr/bin/python ENOENT
Error: Exit code: ENOENT. spawn /usr/bin/python ENOENT
at /Users/erik/dev/tmpElectron/node_modules/builder-util/src/util.ts:133:18
at exithandler (node:child_process:408:5)
at ChildProcess.errorhandler (node:child_process:420:5)
at ChildProcess.emit (node:events:513:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
```

### Command or Code
See above steps

### Environment, Platform, Device
macOS 13.5.2 on M1 Pro (chip is probably not as important as the OS; I think this is a python-not-found issue)

### Version information
Cordova: Cordova-lib@12.0.1
Cordova-electron: 3.1.0
Xcode 14.3.1, but building this from the command line

I should mention that I do have several python installations, but the electron-builder seems to be missing them all:

```
tmpElectron % which -a python python2 python2.7 python3 python3.6
/usr/local/bin/python
/usr/local/bin/python2
/usr/local/bin/python2.7
/opt/homebrew/bin/python3
/usr/bin/python3
```

The only one installed in the directory electron is looking for (`/usr/bin`) is python3 -- I'm guessing that's the version pre-installed with macOS these days.

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `cordova create`, `cordova platform add electron`, and `cordova build electron --verbose` on macOS. Start from the electron-builder output and the `spawn /usr/bin/python ENOENT` error in `node_modules/builder-util/src/util.ts`; done means a plain Cordova Electron project builds successfully without the missing-Python error.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript, nodejs
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.