4

I'm trying to run Firebase Emulator on Bitbucket Pipeline. It fails because "java is not installed".

enter image description here

How can I "install java" on a Bitbucket Pipeline. Or is there another way to get it to work?

My step currently looks like this:

- step: &test-rules
        name: 'Test Firestore Rules (DEV)'
        image: node:16.13.2
        script:
          - npm ci --prefix firebase-test
          - npm install -g firebase-tools
          - npm run test --prefix firebase-test

npm run test runs this script:

firebase emulators:exec --only firestore "mocha --exit"
Phong6698
  • 389
  • 1
  • 3
  • 15

1 Answers1

0

I've just faced this error and managed to solve it. Basically what you need is setting a Docker image that has both, Node and Java, Node for your code and Java for the emulator.

So I've used the image timbru31/java-node available in DockerHub. For me it worked with the version java-node:11-jre-14, but in your case you must want to use the version java-node:11-jdk-16 which contains Node 16 and JDK 11 (or the one you prefer, maybe with newer versions of java and node).

Here's an example:

- step: &test-rules
        name: 'Test Firestore Rules (DEV)'
        image: timbru31/java-node:11-jdk-16
        script:
          - npm ci --prefix firebase-test
          - npm install -g firebase-tools
          - npm run test --prefix firebase-test
KOseare
  • 505
  • 4
  • 11