【问题标题】:Firebase hosting deploy - Cannot read property 'deploys' of undefinedFirebase 托管部署 - 无法读取未定义的属性“部署”
【发布时间】:2020-08-24 15:29:11
【问题描述】:

我正在尝试将 Angular 应用程序部署到 Firebase。 Firebase 设置为托管多个网站。

在 Firebase 中,项目名称为“myapp-staging-84e3e”。 Firebase 中设置了两个站点,分别是“myapp-admin-staging”和“myapp-staging-84e3e”。我正在尝试将此应用部署到“myapp-admin-staging”。

当我尝试运行 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"
      }
    ]
  }
}

我哪里错了?

【问题讨论】:

    标签: firebase-hosting firebase-cli


    【解决方案1】:

    您需要将"target": "admin" 添加到您的firebase.json,使其看起来像这样:

    {
      "hosting": {
        "target": "admin", //added
        "public": "dist/MyApp-Admin",
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ],
        "rewrites": [
          {
            "source": "**",
            "destination": "/index.html"
          }
        ]
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-02
      • 1970-01-01
      • 2014-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-19
      • 1970-01-01
      相关资源
      最近更新 更多