【发布时间】: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