首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >类型“FirebaseApp”上不存在属性“functions”

类型“FirebaseApp”上不存在属性“functions”
EN

Stack Overflow用户
提问于 2018-04-12 04:23:49
回答 1查看 657关注 0票数 2

我一直在尝试使用Firebase Documentation中描述的可调用语法从我的离子应用程序调用Firebase Cloud Functions

我还在StackOverflow中找到了这个以前的question,这似乎是我正在寻找的正确答案……

我遇到问题是,我不能使用"ionic build“来构建我的代码,因为它给了我以下错误:属性'functions‘在类型'FirebaseApp’上不存在

我的代码如下所示:

代码语言:javascript
复制
import firebase from 'firebase';
import '@firebase/functions';
import { ConfigSettings } from '../shared/app.config';

const firebaseApp = firebase.initializeApp(ConfigSettings);
const functions = firebaseApp.functions();

下面是我的package.json中的依赖项:

代码语言:javascript
复制
"dependencies": {
  "@angular/common": "5.0.3",
  "@angular/compiler": "5.0.3",
  "@angular/compiler-cli": "5.0.3",
  "@angular/core": "5.0.3",
  "@angular/forms": "5.0.3",
  "@angular/http": "5.0.3",
  "@angular/platform-browser": "5.0.3",
  "@angular/platform-browser-dynamic": "5.0.3",
  "@firebase/functions": "^0.1.0",
  "@ionic-native/contacts": "^4.6.0",
  "@ionic-native/core": "4.4.0",
  "@ionic-native/facebook": "^4.5.3",
  "@ionic-native/firebase-dynamic-links": "^4.6.0",
  "@ionic-native/google-plus": "^4.5.3",
  "@ionic-native/social-sharing": "^4.6.0",
  "@ionic-native/splash-screen": "4.4.0",
  "@ionic-native/status-bar": "4.4.0",
  "@ionic/pro": "1.0.20",
  "@ionic/storage": "^2.1.3",
  "angularfire2": "^5.0.0-rc.6",
  "cordova-android": "6.4.0",
  "cordova-plugin-contacts": "^3.0.1",
  "cordova-plugin-device": "^2.0.1",
  "cordova-plugin-facebook4": "^1.9.1",
  "cordova-plugin-firebase-dynamiclinks": "^0.13.1",
  "cordova-plugin-googleplus": "^5.2.1",
  "cordova-plugin-ionic-keyboard": "^2.0.5",
  "cordova-plugin-ionic-webview": "^1.1.16",
  "cordova-plugin-splashscreen": "^5.0.2",
  "cordova-plugin-whitelist": "^1.3.3",
  "cordova-plugin-x-socialsharing": "^5.3.2",
  "cordova-sqlite-storage": "^2.2.1",
  "cordova-support-google-services": "^1.1.0",
  "cors": "^2.8.4",
  "es6-promise-plugin": "^4.2.2",
  "firebase": "^4.12.1",
  "ionic-angular": "3.9.2",
  "ionicons": "3.0.0",
  "rxjs": "5.5.2",
  "sw-toolbox": "3.6.0",
  "zone.js": "0.8.18"
}
EN

回答 1

Stack Overflow用户

发布于 2018-04-12 08:23:54

您不应该尝试在您的离子应用程序中编译@firebase/functions包。

在本地调用函数来测试您的构建-它们不应该与您的应用程序捆绑在一起。在编译应用程序时,您将通过函数的正确方法调用函数,例如实时数据库触发器或HTTP触发器,而不是使用@firebase/functions包。

您链接到的说明用于在您的开发环境中进行设置。这些文件与您的应用程序构建是分开的-也许您应该尝试将这些独立文件放在一个单独的目录中,而不是您的Ionic App,这样它们就不会混淆。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49783917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档