简体   繁体   English

错误:在 Firebase 托管中部署 VueJS 应用

[英]ERROR: Deploy VueJS App in Firebase Hosting

I have a vue application, I install firebase tools and upload the application to firebase hosting, the first time all done and I make npm run build and firebase deploy , but when I realise any change, and later do npm run serve or build or firebase deploy I have the next error:我有一个 vue 应用程序,我安装了 firebase 工具并将应用程序上传到 firebase 托管,第一次全部完成,我让npm run buildfirebase deploy ,但是当我意识到任何变化时,后来做npm run servebuildfirebase deploy我有下一个错误:

Template execution failed: ReferenceError: features is not defined

  ReferenceError: features is not defined

  - index.html:4 eval
    [.]/[html-webpack-plugin]/lib/loader.js!./public/index.html:4:10

  - index.html:7 module.exports
    [.]/[html-webpack-plugin]/lib/loader.js!./public/index.html:7:3

  - index.js:284 Promise.resolve.then
    [real]/[html-webpack-plugin]/index.js:284:18


  - next_tick.js:188 process._tickCallback
    internal/process/next_tick.js:188:7

Any idea?任何的想法? I don't know why this problem succeed.我不知道为什么这个问题会成功。 Thank you.谢谢你。

When you installed firebase tools, it generated a public folder for you.当您安装 firebase 工具时,它会为您生成一个公共文件夹。 Inside that public folder, there is an index.html file(this file is the cause of the error).在那个公共文件夹中,有一个 index.html 文件(这个文件是错误的原因)。 Just delete everything inside that index.html file, then replace with your own content.只需删除该 index.html 文件中的所有内容,然后替换为您自己的内容。

In firebase.json file in hosting change "public": "public" to "public": "dist" When you installed firebase, it changed the file public/index.html, the original version looks like this:在托管中的 firebase.json 文件中将"public": "public"更改为"public": "dist"当您安装 firebase 时,它​​更改了文件 public/index.html,原始版本如下所示:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>hello-world-vuetify</title>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
  </head>
  <body>
    <noscript>
      <strong>We're sorry but hello-world-vuetify doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>

Replace the content, it worked for me替换内容,它对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM