Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to build Electron Apps on Mac Pro? Doesn't seem like it due to Bizarre GPU issue

Tags:

macos

electron

I tried to pull and tried to build two different bootstrap repos for Electron apps:

  • https://github.com/pastahito/electron-react-webpack
  • https://github.com/duskload/react-electron-webpack

Followed the instructions only to be getting this error while starting the app using npm start

AVDCreateGPUAccelerator: Error loading GPU renderer

I am using a Mac Pro with macOS Mojave 10.14.5. From what I read: Mac Pros (2013 model)'s GPU architecture stumbles Electron/Chromium [for reasons beyond me]. I do have Electron apps like Slack and Atom running on that machine without problems, but for some reason, it would appear building Electron apps is impossible on Mac Pro. I find that very odd.

Is there anything I can do to be able to develop/build Electron apps on a Mac Pro or is it the official stance of the Electron platform that no development can be done on Mac Pros?

like image 760
JasonGenX Avatar asked Aug 05 '19 15:08

JasonGenX


1 Answers

Problems with the GPU acceleration and rendering can occur on Electron with misconfigured systems or driver issues. There are also other instances where these or similar issues occur, such as when executing Electron via a remote system, X11 forwarding or a remote desktop. In all these instances you will get some kind of GPU initialization error.

For the error you are experiencing, it is actually already covered briefly here on Stack Overflow (however they don't cover a solution);

electron error AVDCreateGPUAccelerator: Error loading GPU renderer

In my Electron applications I always have the following piece of code at the very begining of the application execution;

import { app } from "electron";

if (app.getGPUFeatureStatus().gpu_compositing.includes("disabled")) {
    app.disableHardwareAcceleration();
}

This will check if the GPU supports hardware acceleration and disable it if this is not the case. This check is very important but is not executed by default in Electron for some inexplicable reason - which results in Electron failing to start (or rather open any window) on systems where acceleration is broken or unsupported.

If that doesn't work for you, simply calling (without the check)

import { app } from "electron";

app.disableHardwareAcceleration();

should do the trick - but you should obviously only do it temporarily during development and only if you really need to. The first block of code is the prefered method.

like image 71
Adam Waldenberg Avatar answered Oct 08 '22 00:10

Adam Waldenberg