我一直在尝试编辑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"
} ]
}
然后它运作良好。