在我的离子项目中设置firebase动态链接时遇到问题。
我描述了设置此插件的步骤:
ionic cordova plugin add cordova-plugin-firebase-dynamiclinks --save --variable APP_DOMAIN="example.com" --variable PAGE_LINK_DOMAIN="example.page.link"
npm install @ionic-native/firebase-dynamic-links
import { FirebaseDynamicLinks } from '@ionic-native/firebase-dynamic-links/ngx';
constructor(private firebaseDynamicLinks: FirebaseDynamicLinks) { }
...
// Handle the logic here after opening the app with the Dynamic link
this.firebaseDynamicLinks.onDynamicLink()
.subscribe((res: any) => console.log(res), (error:any) => console.log(error));
之后我尝试构建我的项目并突然出错:
vendor.js:2135 ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
TypeError: Object(...) is not a function
at FirebaseDynamicLinks.onDynamicLink (vendor.js:93256)
at main.js:1006
at t.invoke (polyfills.js:3)
at Object.onInvoke (vendor.js:5446)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:5437)
at t.invokeTask (polyfills.js:3)
at c (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:5437)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)
at o (polyfills.js:3)
defaultErrorLogger @ vendor.js:2135
为了消除这个错误,我搜索了一些博客并通过删除此链接获得了一个链接
npm i rxjs@^6.0 rxjs-compat
之后我再次构建我的项目,现在我遇到了一些奇怪的错误:
[16:34:53] typescript: node_modules/rxjs/internal/types.d.ts, line: 81
'ObservableInput' only refers to a type, but is being used as a value here.
L81: export declare type ObservedValueOf = O extends ObservableInput ? T : never;
我用Google搜索但无法解决此问题。
我试图删除node_modules并再次安装并为平台做同样的事情,但它仍然存在。
这是我的环境信息:
✔ Gathering environment info - done!
Ionic:
ionic (Ionic CLI) : 4.1.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.10
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.1, ios 4.5.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, cordova-plugin-ionic-webview 1.1.1, (and 15 other plugins)
System:
Android SDK Tools : 26.1.1 (/Users/anandmahajan/Library/Android/sdk)
ios-deploy : 1.9.4
NodeJS : v8.11.1 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.2 Build version 9C40b
你只需要安装npm install [email protected] --save
,然后就可以解决了。
安装[email protected]之后出现此问题
vendor.js:1992 ERROR TypeError:Object(...)不是位于main.js的Firebase.getToken(vendor.js:85737)中的函数:1019 at at.tovokeTask(polyfills.js:3)at Object.onInvokeTask (vendor.js:5294)at t.invokeTask(polyfills.js:3)at r.runTask(polyfills.js:3)at e.invokeTask(polyfills.js:3)at i.isUsingGlobalCallback.invoke(polyfills.js) :3)at n(polyfills.js:3)defaultErrorLogger @ vendor.js:1992 ErrorHandler.handleError @ vendor.js:2053
解决了它,通过npm install [email protected] --save