![](/img/trans.png)
[英]Error trying to run an emulator android studio. Gives me this error message
[英]Trying to run Firestore emulator on Gitlab CI pipeline gives "java is not installed" error
嘗試在 Gitlab CI/CD 管道中運行 Firestore 模擬器時,出現以下錯誤:
Firestore Emulator 已退出,因為 java 未安裝,您可以從https://openjdk.java.net/install/安裝它
問題是,如何在這個環境中安裝 java? 我發現了一個類似的帖子,但沒有提到需要安裝 java,所以我想知道我是否遺漏了一些明顯的東西。
這就是我的.gitlab-ci.yml
文件的樣子:
image: node:14.15.4
cache:
paths:
- functions/node_modules/
- project_name/node_modules/
before_script:
- npm i -g firebase-tools
.test_and_deploy:
script:
- cd functions
- npm i
- cd ..
- cd project_name
- npm i
- cd ..
- cd functions
- npm run build
- firebase emulators:exec -P project_name --only firestore "npm run test-once"
- cd ..
- cd project_name
- cp .env.project_name.local .env
- npm run build
- firebase --project project_name deploy
我終於能夠弄清楚如何在 docker 映像中安裝 java,現在 yml 文件中的這部分腳本如下所示:
.test_and_deploy_functions:
script:
# this step installs java, necessary for the firebase emulator
- apt-get update && apt-get install -y openjdk-8-jdk
- cd functions
- npm i
- npm run build
- firebase use project_name
- firebase emulators:exec --only firestore "npm run test-once"
- npx firebase deploy --only functions
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.