使Firebase可以下载文件:firebase.json中的意外令牌

时间:2016-05-02 14:29:58

标签: json firebase firebase-hosting

我一直在尝试编辑firebase.json以使文件可供下载。我知道我可以使用Content-Type: data/octet-stream执行此操作,但只要我firebase deploy,我就会:

$ firebase deploy

Error: There was an error loading firebase.json:

Unexpected token 'h' at 10:4
  "headers": [ {
   ^
File: "/home/barend/Projects/firebase/firebase.json"

这是我的firebase.json:

{
  "firebase": "xxx",
  "public": "public",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**",
    "**/*.pyc"
  ]
  "headers": [ {
  "source" : "**/*.py",
  "headers" : [ {
  "key" : "Content-Type",
  "value" : "data/octet-stream"
} ]
}

我该如何解决这个问题?

更新:在仔细阅读了弗兰克的评论之后,我意识到他的意思是“逗号”,而不是“命令”#39; (愚蠢的我)。我改变了他指出的错误,我又得到了一个错误:

Error: hosting.headers[0] requires property "headers"

这个很容易解决。我必须将headers更改为Headers然后才能正常工作。对于未来的读者,这是固定的代码:

{
  "firebase": "xxx",
  "public": "public",
  "ignore": [
    "firebase.json",
    "**/.*",
    "**/node_modules/**",
    "**/*.pyc"
  ],
  "Headers": [ {
    "source" : "**/*.py",
    "key" : "Content-Type",
    "value" : "data/octet-stream"
   } ]
}

然后它运作良好。

0 个答案:

没有答案