使用Bitbucket管道在Firebase托管中部署Angular应用程序时出现问题

时间:2020-02-25 12:48:34

标签: javascript angular bitbucket bitbucket-pipelines

我正在使用Bitbucket管道在Firebase托管中部署有角度的版本8,但在运行的管道中出现了一些错误。 我对某些文件进行了更改,请检查以下内容: e2e:protractor.conf.js

exports.config = {
...,
  capabilities: {
    'browserName': 'chrome',
    chromeOptions: {
      args: ['--headless', '--no-sandbox']
    }
  }
...}

package.json

  "scripts": {
...,
    "build:prod": "ng build --prod",
    "deploy": "firebase deploy --token $FIREBASE_TOKEN --non-interactive"
}

karma.conf.js

module.exports = function (config) {
  config.set({
...,
    customLaunchers: {
      ChromeHeadlessCI: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    }
})
}

bibucket-pipelines.yml

image: node:10.16.3
pipelines:
   branches:
      master: #master branch
      - step:
         deployment: production
         caches:
         - node
         script:
         - npm install
         - npm install -g @angular/cli
         - npm install -g firebase-tools 
         - ng build --prod
         - ls -laR ./dist #recursively list directories
         - firebase deploy --token=$FIREBASE_TOKEN --project your-prod-firebase-projectname --non-interactive
      develop: # develop branch 
      - step: 
         deployment: test
         caches:
         - node
         script:
         - npm install
         - npm install -g @angular/cli
         - npm install -g firebase-tools 
         - ng build
         - ls -laR ./dist #recursively list directories
         - firebase deploy --token=$FIREBASE_TOKEN --project your-test-firebase-projectname --non-interactive

并且我在bitbucket管道变量中添加了Firebase令牌,但错误显示:

    1. If 'app-header' is an Angular component, then verify that it is part of this module.
    2. If 'app-header' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<app-header></app-header>
    <div class="container-fluid">
      <section>
...

1 个答案:

答案 0 :(得分:0)

您是否尝试在本地运行“ ng serve --prod ”?您可能可以获取有关此错误的更多信息,因为它看起来不像Bitbucket错误,而更像是Angular错误。您还可以将Firebase凭据放入Bitbucket,我对此发表了一篇文章:Build a Bitbucket CI/CD with Angular and Firebase