首页 文章

Firebase服务错误

提问于
浏览
8

我是firebase的新手,我正在尝试创建一个利用用户身份验证的简单应用程序 . 在项目的这一点上,我尝试使用CLI命令在本地服务器上运行firebase .
我已经设置了firebase init和firebase部署 . 当我在我的项目文件夹中键入firebase serve时,我得到了响应,

“发生意外错误” .

下面我附上我的 firebase-debug.log 文件的内容 . 任何帮助,将不胜感激 . 谢谢

命令需要范围:

["email","openid",“_ https://www.googleapis.com/auth/cloudplatformprojects.readonly "," https://www.googleapis.com/auth/firebase”,... [调试] [2017-06-11T17:09:09.607Z]>通过登录用户授权

TypeError:无法读取未定义的属性“public”

6 回答

  • 4

    查看firebase.json文件,您应该在运行 firebase serve 的目录中找到该文件 . 它应该看起来像this

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

    如果它没有 "hosting" 键,那么你将得到 Cannot read property 'public' of undefined 错误,因为 firebase serve 试图访问 .hosting.public .

  • 3

    我今天遇到了这个问题,我用 --debug 运行它,发现我已经安装了npm / node作为 sudo 用户,运行如下:

    firebase serve
    

    给了我这个错误:

    Error: An unexpected error has occurred.
    

    当我使用sudo运行它时,我能够在本地部署托管和功能:

    sudo firebase serve --debug --only hosting,functions
    
  • 0

    1 )创建一个名为"public"的文件夹并将文件放入其中 .

    2 )编辑firebase.json并写下:

    { 
     "hosting": {
    "public": "public" 
    }
    }
    
  • 1

    这似乎是一个错误 - 理想情况下应该用 Firebase Init 来解决 . 我已经在Firebase上记录了一张支持票,并鼓励其他人这样做 .

  • 0

    我想你可能已经意外地跳过了初始化步骤(我在第一次运行时做了同样的事情)

    试试这个(来自你的同一个项目目录):

    1)firebase init

    2)当系统提示您需要哪些服务时,请确保数据库和主机选项的标记突出显示为绿色(使用空格键选择托管) . 很容易选择只是数据库,并让它运行其配置,并假设它配置下面的所有项目符号选项,如果你不仔细观察,因为标准输出信息不是很清楚 . 现在按Enter键

    3)接受您之前可能执行的默认数据库设置,当询问“您想将什么用作公共目录?(公共)”时,按Enter键 .

    此时你应该好好开发一个本地的firebase web服务器......

    4)尝试'firebase serve',点击Enter,你应该得到一个验证主机文件是从/ public提供的

    希望这可以帮助 . 祝好运 .

  • 10

    至于我,错误是( --debug attr)

    Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/logs'
    

    所以解决方案是运行 sudo

相关问题