【问题标题】:Firebase deploy throws error "Hosting key and legacy hosting keys are both present in firebase.json."Firebase 部署引发错误“托管密钥和旧托管密钥都存在于 firebase.json 中。”
【发布时间】:2020-05-28 07:24:06
【问题描述】:

当我运行 firebase 部署时:

    Camerons-MacBook-Pro-2:showboost cameronedwards$ firebase deploy
⚠  "firebase" key in firebase.json is deprecated. Run firebase use --add instead
⚠  hosting: We found a hosting key inside firebase.json as well as hosting configuration keys that are not nested inside the hosting key.


Please run firebase tools:migrate to fix this issue.
Please note that this will overwrite any configuration keys nested inside the hosting key with configuration keys at the root level of firebase.json.

Error: Hosting key and legacy hosting keys are both present in firebase.json.

当我运行 firebase 时,按照建议使用 --add:

    Camerons-MacBook-Pro-2:showboost cameronedwards$ firebase use --add
⚠  "firebase" key in firebase.json is deprecated. Run firebase use --add instead
? Which project do you want to add? showboost-e366b
? What alias do you want to use for this project? (e.g. staging) showboost

Created alias showboost for showboost-e366b.
Now using alias showboost (showboost-e366b)

当我运行 firebase 工具时:按照建议迁移:

Camerons-MacBook-Pro-2:showboost cameronedwards$ firebase tools:migrate
⚠  "firebase" key in firebase.json is deprecated. Run firebase use --add instead
This command is deprecated and will be removed.
i  Checking feature configuration...
i  Checking "firebase" key...

Error: Server Error. certificate has expired

最后,看看我的 firebase.json 文件:

    {
  "firebase": "showboost-e366b",
  "public": "showboost",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**"
  ],
  "rewrites": [
    {
      "source": "/public/**",
      "destination": "/public.html"
    },
    {
      "source": "**",
      "destination": "/index.html"
    }
  ],
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

我已经尝试解决这个问题一段时间了,所以任何帮助都会很棒,谢谢!

编辑 - 我一直在研究它,看起来“firebase 工具:迁移”已被弃用。我需要使用新命令吗?

【问题讨论】:

    标签: node.js reactjs firebase react-native


    【解决方案1】:

    有同样的问题,但在您的情况下,您有 2 个 rewrites 数组实例可用,这应该不是问题。

    替换你的最后一个数组

     "rewrites": [
     {
       "source": "**",
       "destination": "/index.html"
     }
    ]
    

    "rewrites": [
      {
        "source": "**",
        "function": "app"
      }
    ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-14
      • 1970-01-01
      • 2016-02-17
      • 1970-01-01
      • 2018-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多