簡體   English   中英

角型火力主機托管失敗

[英]angular firebase hosting unsuccessful

我正在按照本教程構建角度漸進式Web應用程序。

我在Firebase上創建了項目,並成功部署了它。

You're about to initialize a Firebase project in this directory:

  /Users/nitish/development/ng-pwa

Before we get started, keep in mind:

  * You are initializing in an existing Firebase project directory

? Which Firebase CLI features do you want to setup for this folder? Press Space to select featu
res, then Enter to confirm your choices. Hosting: Configure and deploy Firebase Hosting sites

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

i  .firebaserc already has a default project, skipping

=== Hosting Setup

Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? dist
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? File dist/index.html already exists. Overwrite? No
i  Skipping write of dist/index.html

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...

✔  Firebase initialization complete!
shannon:ng-pwa nitish$ firebase deploy

=== Deploying to 'ng-pwa-6b066'...

i  deploying hosting
i  hosting: preparing dist directory for upload...
✔  hosting: 10 files uploaded successfully

✔  Deploy complete!

主辦:

shannon:ng-pwa nitish$ firebase open hosting:site
Opening Hosting: Deployed Site link in your default browser:
https://ng-pwa-6b066.firebaseapp.com
shannon:ng-pwa nitish$ 

但是,在瀏覽器中,我只能看到:

在此處輸入圖片說明

我的項目結構與dist文件夾:

在此處輸入圖片說明

為什么會這樣呢?

該指南適用於Angular 5,以及如何在Angular 6中構建Angular應用程序。

在運行firebase init時,答案之一需要更改。 現在,公共目錄是特定於應用程序的,而不僅僅是dist

您想使用什么作為公用目錄? DIST / NG-PWA

對於現有應用,您可以從以下位置更改firebase.json

{
  "hosting": {
    "public": "dist",
    ...
  }
}

至:

{
  "hosting": {
    "public": "dist/ng-pwa",
    ...
  }
}

這是因為Angular使使用CLI構建多個應用程序變得更加容易,因此它們需要在dist擁有自己的文件夾。 如果需要特定步驟, pwa.ng是最新指南。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM