Error when installing openjdk-11-jdk-headless

I have the following command in package.json to install openjdk-11-jdk-headless:

“eas-build-pre-install”: “apt-get update; apt-get -y install openjdk-11-jdk-headless”

but getting the following error during build:

Script ‘eas-build-pre-install’ is present in package.json, running it…
yarn run v1.22.17
$ apt-get update; apt-get -y install openjdk-11-jdk-headless
Reading package lists…

[stderr] E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
[stderr] E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
[stderr] E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
[stderr] error Command failed with exit code 100.
info Visit yarn run | Yarn for documentation about this command.
yarn exited with non-zero code: 100

This used to work fine a while ago. Any ideas why I’m getting this error now?

I think a better alternative to this would be to just pick an image for EAS builds that already includes Java 11. You can do this by setting the android → image property for your build profile in eas.json (Build schema for eas.json - Expo Documentation). The image latest contains Java 11. For more information about the available images, check the build infrastructure docs page here: Build server infrastructure - Expo Documentation

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.