Polymerfire 元素使应用程序崩溃

2024-04-30

我刚刚添加了新型聚合物火<firebase-app> element https://github.com/firebase/polymerfire/blob/master/firebase-app.html到我的(Polymer 1.x + Firebase 3.x)项目,它使项目崩溃了。我希望在本地主机上看到主屏幕加载,但相反,我只是得到一个空白屏幕和控制台错误。

my-element.html
<firebase-app auth-domain="my-app-id.firebaseapp.com"
              database-url="https://my-app-id.firebaseio.com/"
              api-key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
</firebase-app>

控制台日志报告以下错误:

Console.log

firebase-app.html:94
未捕获的引用错误:firebase 未定义

相关代码行(第 94 行)如下:

firebase-app.html, line 94
firebase.initializeApp.apply(firebase, init); // Line 94, highlighted error

firebase-app 元素的完整源代码位于此处 https://github.com/firebase/polymerfire/blob/master/firebase-app.html.

https://github.com/firebase/polymerfire/blob/master/firebase-app.html
<!--
@license
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file or at
https://github.com/firebase/polymerfire/blob/master/LICENSE
-->

<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="firebase.html">
<dom-module id="firebase-app">
  <script>
    (function() {
      'use strict';
      /**
       * The firebase-app element is used for initializing and configuring your
       * connection to firebase.
       */
      Polymer({
        is: 'firebase-app',
        properties: {
          /**
           * The name of your app. Optional.
           *
           * You can use this with the `appName` property of other Polymerfire elements
           * in order to use multiple firebase configurations on a page at once.
           * In that case the name is used as a key to lookup the configuration.
           */
          name: {
            type: String,
            value: ''
          },
          /**
           * Your API key.
           *
           * Get this from the Auth > Web Setup panel of the new
           * Firebase Console at https://console.firebase.google.com
           *
           * It looks like this: 'AIzaSyDTP-eiQezleFsV2WddFBAhF_WEzx_8v_g'
           */
          apiKey: {
            type: String
          },
          /**
           * The domain name to authenticate with.
           *
           * The same as your Firebase Hosting subdomain or custom domain.
           * Available on the Firebase Console.
           *
           * For example: 'polymerfire-test.firebaseapp.com'
           */
          authDomain: {
            type: String
          },
          /**
           * The URL of your Firebase Realtime Database. You can find this
           * URL in the Database panel of the Firebase Console.
           * Available on the Firebase Console.
           *
           * For example: 'https://polymerfire-test.firebaseio.com/'
           */
          databaseUrl: {
            type: String
          },
          /**
           * The Firebase app object constructed from the other fields of
           * this element.
           */
          app: {
            type: Object,
            notify: true,
            computed: '__computeApp(name, apiKey, authDomain, databaseUrl)'
          }
        },
        __computeApp: function(name, apiKey, authDomain, databaseUrl) {
          if (apiKey && authDomain && databaseUrl) {
            var init = [{
              apiKey: apiKey,
              authDomain: authDomain,
              databaseURL: databaseUrl
            }];
            if (name) {
              init.push(name);
            }
            firebase.initializeApp.apply(firebase, init);
          } else {
            return null;
          }
          return firebase.app(name);
        }
      });
    })();
  </script>
</dom-module>

评论摘要:@Bogdan.Nourescu 是正确的。我没有正确安装 firebase-sdk 目录。

我必须使用 Bower 使用以下命令安装 Polymerfire 依赖项:

bower install --save firebase/polymerfire

Note: bower install --save polymerfire指向 DivShot 的版本现已过时。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Polymerfire 元素使应用程序崩溃 的相关文章

  • Ruby on Rails - 复选框未保存到数据库?

    我有一个迁移 它使用布尔值并在其视图中生成一个复选框 但是 无论我单击什么 保存到数据库的值都不会受到影响 我的迁移看起来像这样 def self up create table blogposts do t t string title
  • 如何读取FTL文件中的JSONArray?

    我在我的 Java 文件中硬编码了以下 JSON 对象 JSONObject notificationInfoJson new JSONObject notificationInfoJson put title Payment Receiv
  • Hapijs 在一个连接上同时使用 Http 和 Https

    New to Hapijs http hapijs com 并尝试使用它来创建一个应用程序 该应用程序对所有请求使用 HTTPS 并将 HTTP 重定向到安全连接 问题是应用程序进入 HTTPS 模式没有问题 但如果我将 URL 更改为 H
  • Cassandra 会话与集群 有什么可分享的?

    考虑 Cassandra 的 Session 和 Cluster 类 Java 驱动程序 我想知道有什么区别 在 Hibernate 中 每次都会创建一个会话并共享会话工厂 从许多来源我了解到 它被认为是创建一个会话并在多个线程之间共享它
  • Git - 在特定提交之前压缩历史记录中的所有提交

    我有一个 Mercurial 存储库 正在将其转换为 Git 提交历史记录非常大 我不需要新存储库中的所有提交历史记录 一旦我将提交历史记录转换为 Git 并且在推送到新存储库之前 我想将某个标记之前的所有提交压缩为一个提交 所以 如果我有
  • 如何设置 Swashbuckle 与 Microsoft.AspNetCore.Mvc.Versioning

    我们有asp net core webapi 我们添加了Microsoft AspNetCore Mvc Versioning and Swashbuckle拥有招摇的用户界面 我们将控制器指定为 ApiVersion 1 0 Route
  • ftrace 是否允许捕获 Linux 内核的系统调用参数,或者仅捕获函数名称?

    目标是检查任何进程传递给特定系统调用 例如 exec open 等 的参数 来自官方文档 https www kernel org doc Documentation trace ftrace txt 没有描述记录函数参数的功能 主要查看
  • 如何制作饼图聚合数据源?

    Using 适用于 ASP NET MVC 的 Kendo UI 完整版 http www kendoui com 版本 2013 3 1119 2013年11月20日 如果我有这段代码 status chart kendoChart da
  • 在 url 中传递百分号 (%) 并使用 php 获取其准确值

    我正在尝试在 url 中传递百分号 例如 B6011000995504101 SB 但当我回声时 它又回来了 011000995504101 SB 我想要与在 URL 中传递的值完全相同的值 我尝试使用 urlencode 函数 但它给了我
  • 如何使用 jQuery 和“this”捕获更改的表单元素值

    我有以下代码 每当我的 Web 表单中发生元素更改时 该代码都会起作用 我一直在纠结的是如何捕捉表单字段元素 id name and 改变值当更改事件被触发时 谁能帮我解决这个问题吗 Thanks JavaScript
  • 闪亮的本地部署错误:输入字符串 1 无效 UTF-8

    我很惊讶地发现一个突然的错误 我的 ShinyApp 停止工作并出现未知错误 提示 输入字符串 1 无效 UTF 8 即使在昨天 该应用程序也可以正常运行 但是突然停止了 下面是我运行时的错误描述runApp gt runApp Liste
  • ES6解构对象赋值函数参数默认值

    您好 我正在查看在传递函数参数时使用对象解构的示例对象解构演示 https developer mozilla org en US docs Web JavaScript Reference Operators Destructuring
  • 在Python中使用os.makedirs创建目录时出现权限问题

    我只是想处理上传的文件并将其写入工作目录中 该目录的名称是系统时间戳 问题是我想以完全权限创建该目录 777 但我不能 使用以下代码创建的目录755权限 def handle uploaded file upfile cTimeStamp
  • 将蒙版图像作为 PNG 文件写入磁盘

    基本上 我从网络服务器下载图像 然后将它们缓存到磁盘上 但在这样做之前 我想屏蔽它们 我正在使用每个人似乎都指出的屏蔽代码 可以在这里找到 http iosdevelopertips com cocoa how to mask an ima
  • Java编程编译jar

    我有一个文本文件中的java源代码 必须在源代码中输入一些自定义的硬编码变量 然后将其转换为 jar 这是可行的 但是当我运行 jar 时 找不到 Main 类 当我用 WinRAR 解压 jar 文件时 我似乎找不到错误 当我通过 cmd
  • Android 中用于过渡的自定义动画对象?

    我想用一些更奇特的东西来覆盖 Android 中的默认活动转换 我想做的事情不能用通常使用的 XML 集来完成 所以我不能使用overridePendingTransition因为它只接受对基于 XML 的动画资源的整数引用 我想做的是创建
  • dplyr::mutate 添加多个值

    网上有几个与此相关的问题dplyr Github 存储库 https github com hadley dplyr已经 并且至少有一个相关的问题 但没有一个问题完全涵盖了我的问题 我认为 在 dplyr mutate 调用中添加多列 ht
  • git jenkins 中未找到存储库

    我正在使用 jenkins 2 64 并安装了最新的插件 我试图在 jenkins 中设置 git 存储库并给出凭据 但给出错误无法连接存储库 状态代码为 128 Cloning repository https github com so
  • 使用 ActivePerl 时为什么必须指定带有备份扩展的 -i 开关?

    除非我使用备份扩展指定它们 否则我无法就地编辑在 ActivePerl 下运行的 Perl 单行代码 C gt perl i ape splice F 2 0 q inserted text qq F n file1 txt Can t d
  • 通过jquery ajax()和serialize()提交html表单

    我想通过 jquery ajax 提交此表单 这是我所做的 但它不起作用 即表单正在提交并刷新页面 但我没有看到响应 即在同一页面上打印数组 HTML

随机推荐