我正在尝试将一个有角度的应用程序部署到Firebase。Firebase设置为托管多个站点。
在Firebase中,项目名称为"myapp-staging-84e3e"。Firebase中设置了两个站点,分别是"myapp-admin staging"one_answers"myapp-staging-84e3e"。我正在尝试将此应用程序部署到"myapp管理员暂存"。
当我尝试运行firebase deploy --only hosting:admin
时,我在firebase-debug.log
中得到以下错误;
[debug] [2020-08-24T15:19:23.581Z] TypeError: Cannot read property 'deploys' of undefined
at /usr/local/lib/node_modules/firebase-tools/lib/deploy/index.js:84:36
at processTicksAndRejections (internal/process/task_queues.js:82:5)
[error]
[error] Error: An unexpected error has occurred.
我一定有什么设置不正确,但我无法确定它是什么。我的.firebaserc
文件如下所示;
{
"targets": {
"myapp-staging-84e3e": {
"hosting": {
"admin": [
"myapp-admin-staging"
]
}
}
},
"projects": {
"default": "myapp-staging-84e3e"
}
}
则firebase.json
文件如下所示;
{
"hosting": {
"public": "dist/MyApp-Admin",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
我哪里错了?
您需要将"target": "admin"
添加到firebase.json
中,使其看起来像这样:
{
"hosting": {
"target": "admin", //added
"public": "dist/MyApp-Admin",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}