【问题标题】:Firebase not recognized while using GitLab CI使用 GitLab CI 时无法识别 Firebase
【发布时间】:2019-10-01 01:29:10
【问题描述】:

我正在尝试使用 GitLab CI/CD 将 Angular 应用程序部署到 Firebase。

我的.gitlab-ci.yml 看起来像这样

stages:
  - build
  - test
  - deploy

build:
  stage: build
  script: 
    - ng build --prod --aot

test:
  stage: test
  script: 
    - echo Running tests...

deploy:
  stage: deploy
  script: 
    - call npm install -g firebase-tools
    - firebase deploy --token $FIREBASE_TOKEN

我在我的本地 PC 上使用 gitlab-runner,即使我已经安装了我需要的所有东西,并且我可以在本地毫无问题地运行这些脚本,但我不能用 GitLab CI/CD 做同样的事情。

说到部署阶段,我一直在努力

$ firebase deploy --token $FIREBASE_TOKEN
'firebase' 无法识别 作为内部或外部命令、可运行程序或批处理文件。

【问题讨论】:

  • 您使用的是哪个执行器?在您的deploy 阶段,您没有使用带有所需工具的 Docker 映像。使用现有的或构建自己的。
  • 我正在使用跑步者,我用shell executor 配置了localy。我确信如果脚本在我的本地机器上运行良好,它也可以像 gitlab-runner 一样正常运行,但我想我错了?
  • 在这种情况下,它可能与 PATH 相关。确保 PATH 具有正确的值。

标签: angular firebase continuous-integration gitlab continuous-deployment


【解决方案1】:

您需要先安装它,然后再使用它。

  • npm install -g firebase-tools

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-18
    • 2016-09-11
    • 1970-01-01
    • 1970-01-01
    • 2020-10-19
    • 2019-04-11
    • 2019-10-26
    • 1970-01-01
    相关资源
    最近更新 更多