Cannot run/build android - Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository()

I’m trying to build my react-native expo app for Android to test it on an Android emulator/simulator before submitting it to the Play Store. I’m using eas-cli/5.2.0 and node-v19.5.0.
When I run npm run android, I get the following error:

› Building app…

Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • What went wrong:

A problem occurred configuring project ‘:expo-dev-launcher-gradle-plugin’.

Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().

Failed to create parent directory ‘/Users/a/Desktop/b/b-Frontend/node_modules/expo-dev-launcher/expo-dev-launcher-gradle-plugin/.gradle’ when creating directory ‘/Users/a/Desktop/b/b-Frontend/node_modules/expo-dev-launcher/expo-dev-launcher-gradle-plugin/.gradle/buildOutputCleanup’

Later on, I also see:

BUILD FAILED in 14s
Error: /Users/a/Desktop/b/b-Frontend/android/gradlew exited with non-zero code: 1
Error: /Users/a/Desktop/b/b-Frontend/android/gradlew exited with non-zero code: 1
at ChildProcess.completionListener (/Users/a/Desktop/b/b-Frontend/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
at Object.onceWrapper (node:events:627:26)
at ChildProcess.emit (node:events:512:28)
at maybeClose (node:internal/child_process:1098:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)

at Object.spawnAsync [as default] (/Users/a/Desktop/b/b-Frontend/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
at spawnGradleAsync (/Users/a/Desktop/b/b-Frontend/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46)
at Object.assembleAsync (/Users/a/Desktop/b/b-Frontend/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18)
at runAndroidAsync (/Users/a/Desktop/b/b-Frontend/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:31:24)