【问题标题】:push a Angular5 application with firebase db to GitHub将带有 firebase db 的 Angular5 应用程序推送到 GitHub
【发布时间】:2018-09-16 22:22:04
【问题描述】:

我使用 Angular5 创建了一个应用程序,它由 firebase 数据库托管。我想将我的应用推送到 GitHub,我创建了一个存储库并推送成功。

但是当我下载它并运行以下命令“npm install”和“ng serve --open”但它不显示我的应用程序并显示新创建项目的起始页面。

我应该怎么做才能正确获取或正确部署我的应用程序??

【问题讨论】:

  • 需要更多信息,您是否推送了这些更改以及您是如何从 git repo 签出代码的?
  • 我通过将存储库下载为 zip 文件来检查它。我在完成申请后推送。
  • 不,您应该签出而不是下载,使用命令 git clone 和存储库的 url。无论哪种方式,您都需要添加更多详细信息,例如应用程序不显示起始页的原因、您是否在浏览器中看到任何错误等。您提供的信息越多,就越容易找到解决方案。跨度>
  • 谢谢 vimukthi,我一定会尝试克隆 url。当我下载后运行应用程序时,它没有给出任何错误,但它显示了每个新项目的 app.component.html 视图。
  • 我成功了,得到stackoverflow.com/questions/44033079/…的帮助

标签: firebase github deployment angular5


【解决方案1】:

确保您已将该字段添加到 environment.prod.ts

应该如下,

export const environment = {
  production: true,
  firebase: {
    apiKey: "...",
    authDomain: "project.firebaseapp.com",
    databaseURL: "https://project.firebaseio.com",
    projectId: "project",
    storageBucket: "project.appspot.com",
    messagingSenderId: "..."
  }
};

之后

 1. ng build --prod
           2. npm install -g angular-cli-ghpages
           3. git add .
           4. git commit -m"first commit"
           5. git remote add origin git@github.com:yourinfo/yourgit.git
           6. git push -u origin master
           7. ng build --prod --base-href="https://YourUserName.github.io/Repo-Name/"
           8. angular-cli-ghpages

如果一切顺利,它会响应成功发布!

【讨论】:

    猜你喜欢
    • 2015-12-21
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 2020-10-22
    • 1970-01-01
    • 1970-01-01
    • 2017-04-22
    • 2020-11-17
    相关资源
    最近更新 更多