代码之家  ›  专栏  ›  技术社区  ›  Thinker

角度火力基地托管失败

  •  1
  • Thinker  · 技术社区  · 7 年前

    我在跟踪 this tutorial 以构建角度渐进的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$ 
    

    但是在我的浏览器中,我看到的是:

    enter image description here

    我的项目结构和dist文件夹:

    enter image description here

    为什么会这样?

    1 回复  |  直到 7 年前
        1
  •  2
  •   abraham    7 年前

    该指南针对的是Angular5以及Angular应用程序在Angular6中的构建方式。

    跑步时 firebase init 其中一个答案需要改变。公共目录现在是特定于应用程序的,而不是 dist .

    你想用什么作为你的公共目录?DIST/NG-PWA

    对于现有的应用程序,您可以更改 firebase.json 来自:

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

    到:

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

    这是因为Angular使使用cli构建多个应用程序变得更容易,因此它们需要自己的文件夹 迪特 . pwa.ng 如果您需要特定的步骤,请参阅更新的指南。

    推荐文章