簡體   English   中英

部署后“Firebase 托管設置完成”

[英]"Firebase Hosting Setup Complete" after deploy

我已經嘗試解決這個問題 2 天了,但我還找不到可行的解決方案:(

我正在將我的 React 單頁應用程序部署到 Firebase 托管上,但在部署后我得到了這個著名的頁面“Firebase 托管設置完成”。 我嘗試從 public 和 build 文件夾中的 index.html 進行部署,但它們都不起作用。 看起來我在初始化后沒有在我的項目中創建 firebase.json 或 firebaserc 文件。 會不會是這個原因?

以下是設置的屏幕截圖:在此處輸入圖像描述在此處輸入圖像描述

我找到了解決方案。 我實際上是在我的項目 /users/maxime 而不是 /users/maxime/projectname 之外運行命令!

在此代碼上更新您的 index.html 文件,然后命令npm run build然后firebase deploy它將正常工作。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
    <!--
      manifest.json provides metadata used when your web app is installed on a
      user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
    -->
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
    <!--
      Notice the use of %PUBLIC_URL% in the tags above.
      It will be replaced with the URL of the `public` folder during the build.
      Only files inside the `public` folder can be referenced from the HTML.

      Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
      work correctly both with client-side routing and a non-root public URL.
      Learn how to configure a non-root public URL by running `npm run build`.
    -->
    <title>React App</title>
  </head>
  <body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <!--
      This HTML file is a template.
      If you open it directly in the browser, you will see an empty page.

      You can add webfonts, meta tags, or analytics to this file.
      The build step will place the bundled scripts into the <body> tag.

      To begin the development, run `npm start` or `yarn start`.
      To create a production bundle, use `npm run build` or `yarn build`.
    -->
  </body>
</html>

請確保項目構建正確完成。

構建時firebase init有時無法正常工作。

所以在 firebase firebase deploy之前手動運行構建命令(例如: npm run build

暫無
暫無

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

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