Thanks for looking into that and providing some possible solutions. The target directory is on an internal drive. Interestingly it works if I leave the output directory field blank. Then it builds into the project folder (which is in a folder synced with Google Drive).
I only have the error in 2.2.27, but it works in 2.3.6 so I consider updating it.