Raf*_*ura 5 deployment error-handling json syntax-error firebase
我正在尝试使用 部署一个项目firebase init
。当我到达询问我这个问题的部分时:“实时数据库安全规则应该使用什么文件?database.rules.json”,我按 Enter 键并出现错误:
Error: Unable to parse JSON: SyntaxError: Unexpected token } in JSON at position 540
我应该怎么办?请帮忙。
小智 2
使用--debug
参数我发现,如果 init 目录中没有database.rules.json
文件,它将自动复制项目中在线的文件。但问题是:如果数据库尚未初始化,它将返回无效的 json(因为规则尚未设置)。
那么修复方法如下:
database.rules.json
在项目目录中创建您自己的文件并使用有效的 json 配置它。{
"rules": {
".read": true,
".write": false
}
}
Run Code Online (Sandbox Code Playgroud)
What file should be used for Realtime Database Security Rules?
使用已创建的文件的部分时(通常只是“database.rules.json”)。File database.rules.json already exists. Do you want to overwrite it with the Realtime Database Security Rules for insektenhotel-default-rtdb f rom the Firebase console?
(如果文件不存在,则会自动回答“是”,从而导致问题)。说不。现在应该可以了。
归档时间: |
|
查看次数: |
2959 次 |
最近记录: |