Does not install or run on Apple Silicon Macs
JamieKnightBBC opened this issue · 5 comments
Summary
BBC-a11y fails to install or run when running on Macs powered by Apple Silicon / M1 hardware.
Expected Behaviour
The tool should install and run on Apple Silicon Macs
Current Behaviour
The tools fails to install with the following error:
Downloading electron-v2.0.18-darwin-arm64.zip
npm ERR! Error: GET https://github.com/electron/electron/releases/download/v2.0.18/electron-v2.0.18-darwin-arm64.zip returned 404
npm ERR! /Users/jamie/workspace/bbc/bbc-a11y/node_modules/electron/install.js:54
npm ERR! throw err
npm ERR! ^
npm ERR!
npm ERR! Error: Failed to find Electron v2.0.18 for darwin-arm64 at https://github.com/electron/electron/releases/download/v2.0.18/electron-v2.0.18-darwin-arm64.zip
npm ERR! at Request.<anonymous> (/Users/jamie/workspace/bbc/bbc-a11y/node_modules/nugget/index.js:169:61)
npm ERR! at Request.emit (node:events:376:20)
npm ERR! at Request.onRequestResponse (/Users/jamie/workspace/bbc/bbc-a11y/node_modules/request/request.js:1066:10)
npm ERR! at ClientRequest.emit (node:events:376:20)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:664:27)
npm ERR! at HTTPParser.parserOnHeadersComplete (node:_http_common:126:17)
npm ERR! at TLSSocket.socketOnData (node:_http_client:530:22)
npm ERR! at TLSSocket.emit (node:events:376:20)
npm ERR! at addChunk (node:internal/streams/readable:304:12)
npm ERR! at readableAddChunk (node:internal/streams/readable:279:9)
Possible Solution
I tried using Electron 11 (which has prototype support for Apple Silicon Macs) and it seemed incompatible. Electron launched and crashed without giving an error I could capture.
Steps to Reproduce (for bugs)
Perform the steps below on a Mac with a Apple Silicon CPU such as the M1.
- npm install bbc-a11y
Context & Motivation
It's not longer possible to buy a 13" MacBook Air with an intel chip and Apple has stated all Macs will be powered by in house processors within the next 18 months. At that point BBC-a11y will no longer be compatible with modern Macs.
Your Environment
- Version used: @latest
- Operating System and version: Mac OS 11.1 (M1 Mac mini)
TLDR:
I worked through a few different work arounds. Nothing I did to make it run natively worked (see details below) but Docker did work so there is at least a work around for this issue.
Things I tried
- Running terminal under rosette 2 - app installs, but fails with the error:
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at Object.<anonymous> (/Users/jamie/workspace/bbc/bbc-a11y/node_modules/electron/index.js:9:9)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/Users/jamie/workspace/bbc/bbc-a11y/bin/bbc-a11y.js:6:16)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
- Updating package.json to use electron 11, clean install of the tool - fails with the following error:
Uncaught Exception:
TypeError: Parameter 'filter' must have property 'urls'.
at App.createWindow (/Users/jamie/workspace/bbc/bbc-a11y/electron/bbc-a11y.js:41:45)
at App.emit (events.js:315:20)
Investigating the error didn't lead to much. The line identified doesn't relate to url's or filters and if removed electron hangs without firing an error elsewhere in the process. A deeper dive might fix this.
- Docker - the latest version of docker supports amd64 images on Apple Silicon chips QEMU - this ran to completion, with the following debug output:
$ docker run --rm --tty bbca11y/bbc-a11y-docker http://www.bbc.co.uk/news/0
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Xlib: extension "RANDR" missing on display ":99".
qemu: unknown option 'type=gpu-process'
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
qemu: unknown option 'type=gpu-process'
qemu: unknown option 'type=gpu-process'
qemu: unknown option 'type=gpu-process'
qemu: unknown option 'type=gpu-process'
qemu: unknown option 'type=gpu-process'
qemu: unknown option 'type=gpu-process'
qemu: unknown option 'type=gpu-process'
http://www.bbc.co.uk/news/0
* Forms: Managing focus: Forms must have submit buttons
- Form has no submit button: //form[@id='orb-search-form']
⚠ Structure: Headings: Headings must be in ascending order
- First heading was not a main heading: //div[@id='bbcprivacy-prompt']/h2
* Structure: Headings: Content must follow headings
- No content follows: //div[@id='u4973601124508454']/div/div/div/div[3]/div/div[2]/div/div/h3
* Text equivalents: Tooltips and supplementary information: Title attributes must not duplicate content
- Title attribute duplicates content: //div[@id='u4973601124508454']/div/div/div/div[2]/div[2]/div/div[1]/div[2]/button
For details on how to fix these errors, please see the following pages:
- http://www.bbc.co.uk/guidelines/futuremedia/accessibility/mobile/forms/managing-focus
- http://www.bbc.co.uk/guidelines/futuremedia/accessibility/mobile/structure/headings
- http://www.bbc.co.uk/guidelines/futuremedia/accessibility/mobile/text-equivalents/tooltips-and-supplementary-information
1 page checked, 3 errors found, 1 warning, 0 standards skipped
Thank you again for doing that @JamieKnightBBC. It's good to know that the Docker route seems close to working, perhaps if all dependencies are updated.
It also puts some weight to exploring Chromium as an alternative to Electron, raised as #282 .
A big update on this today, I got it working with the current codebase, running the following command before running the general install:
$ npm install --arch=x64 electron@2.0.8
This command forces the download of the x64 build of electron, which then gets executed using rosette.
The feels like a workable solution for now. @EmmaJP - mind if I add this to the instructions?
Go for it! Great investigation!!
Opened a PR (#335) so will close this thread for now.