Deploying Firebase and Node.js application results in error: Error: Parse Error in remoteconfig.template.json: Unexpected token 'i' at 1:1

Deploying Firebase and Node.js application results in error: Error: Parse Error in remoteconfig.template.json: Unexpected token 'i' at 1:1

我尝试了此门户网站中提到的许多事情 none 成功了,因此发布了相同的内容。

我已经使用 Node.js 创建了一个 Web 应用程序,我正在尝试使用 Firebase 托管该应用程序,以便我的同事可以访问它并试用这些功能。我遵循了 Firebase 提供的说明和 运行 以下命令:

  1. 在 Firebase 控制台中创建了一个项目

  2. npm install -g firebase-tools

  3. firebase login

  4. firebase init(已选择 HOSTING,空格键和旁边出现 * 号)

  5. 我有一个 public 文件夹,里面有 index.html 文件。

  6. firebase deploy

当我 运行 firebase deploy 我得到以下错误:

我看了一些答案,基于这些答案似乎对我来说一切都很好:

我的 firebase.json 文件包含以下内容:

    {
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  },
  "remoteconfig": {
    "template": "remoteconfig.template.json"
  }
}

不确定到底出了什么问题。有人可以帮助我如何在 Firebase 中托管 Node.js 应用程序。

经过一些尝试,我能够解决问题,发布相同的内容以便将来对某人有所帮助:

  1. 我从项目文件夹中删除了之前 firebase init 期间创建的 .firebasercfirebase.json 文件。

  2. 我又开始使用 firebase init 并且成功了。

我认为解决方案是将 {} 添加到有问题的 remoteconfig 文件中,从而使其有效 JSON。它目前完全是空的。