【问题标题】:Firebase node js Error: Cannot understand what targets to deploy/serveFirebase 节点 js 错误:无法理解要部署/服务的目标
【发布时间】:2021-06-24 01:33:33
【问题描述】:

我正在学习本教程: https://www.youtube.com/watch?v=LOeioOKUKI8&t=484s

尝试本地部署应用程序时出现以下错误:

无法理解要部署/服务的目标。没有目标 在 firebase.json 匹配“--only 功能托管”。如果您使用 PowerShell,请确保在任何以逗号分隔的列表周围加上引号(例如:--only "functions,firestore")。

我已部署到 firebase,但屏幕为空,因此我的代码缺少必要的内容。

{
  "hosting": {
    "public": "public",
    "rewrites": [{
      "source": "/timestamp",
      "function": "app"
    }],
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}
const functions = require("firebase-functions");
const express = require('express');

const app = express();
app.get('/timestamp', (req,res)=>{
    res.send('${Date.now()}')
})

exports.app = functions.https.onRequest(app);

【问题讨论】:

    标签: node.js firebase firebase-hosting


    【解决方案1】:

    打开 firebase.json' 文件并粘贴以下内容:

      {
       "hosting": {
       "public": "public"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-02-06
      • 2017-12-06
      • 2017-03-29
      • 1970-01-01
      • 2019-02-03
      • 2023-03-10
      • 2016-06-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多