问题:我有一个web项目托管在Firebase,部署良好。我想添加一个新的网站到同一个项目。设置目标后,Firebase部署失败。
复制的步骤
- 更新Firebase CLI到9.16.0
- 在Firebase主机控制台创建新站点。名称:autoscrib-testv2
- 运行
firebase target:apply hosting test autoscrib-testv2
。Firebaserc更新为:
{
"projects": {
"default": "autoscrib"
},
"targets": {
"autoscrib": {
"hosting": {
"test": [
"autoscrib-testv2"
]
}
}
}
}
- 更新重火力点。json
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"target":"test",
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "/sw.js",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
]
},
"storage": {
"rules": "storage.rules"
}
}
** Deploy Emulator工作正常**
- 运行
firebase emulators:start --only hosting:test
- 网站部署在本地主机:5000
错误消息
- Run
firebase deploy --only hosting:test
- 上传文件时进程停止,显示:
任务38b07412931a6e5cf159943f5f46b65148978924d7f49bab13392fafd8b168d8失败:重试6次后耗尽,错误:"路径";参数必须为字符串类型。收到未定义的
**如果没有创建目标,网站可以正常部署**
运行firebase init解决问题。cli update.