7
votes

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

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?

1
Are you sure you're using a MacPro (a 2013+ one looks like a small cylinder on your desk) and not a MacBook Pro? The MacPro has 2 discrete GPUs in the 2013+ models (a minimum of one in the unreleased 2019 model) and at least one in all prior models. For the MacBook Pro, there are versions with and without discrete GPUs.gaige
Yes. Mac Pro 2013. The "darth vader" cylinder.JasonGenX
Which node version are you using? I would also switch to node 10, 12 and check if anything changesTarun Lalwani
Please don't mix questions. I edited it accordingly... The second NPM dependency problem you were having is unrelated to the original question - so please make a new one.Adam Waldenberg
True, accepted the edit.JasonGenX

1 Answers

13
votes

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.