离子应用无法正常工作,无法找到模块'cordova-plugin-appsee'

时间:2018-03-17 23:11:00

标签: cordova ionic-framework

我正在接管Cordova / Ionic项目。我之前从未与Cordova或Ionic合作过,所以我在那个领域是初学者。但是,我已经和Node一起工作了几年,所以我大多都知道这一点。

我问了一个问题并实施了解决方案:

How to register code with the deviceready event in a Cordova / Ionic project?

这让我遇到了这个问题:

Ionic2, how to import custom plugin (appsee or uxcam) into Ionic App

我不清楚该页面上的答案意味着什么。

现在,在此文件中:

src/app/app.component.ts

我现在有这个导入语句:

import { Component, ViewChild } from '@angular/core';
import { Platform, Nav, App } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { Storage } from '@ionic/storage';
import { LoginPage } from '../pages/login/login';
import { TabsPage } from "../pages/tabs/tabs";
import { ProfilePersonThingsPage } from "../pages/profile-person-things/profile-person-things";
import { CreateProfileBasicsPage } from '../pages/create-profile-basics/create-profile-basics';
import { Keyboard } from '@ionic-native/keyboard';
import { ProfileOwnerEditPage } from '../pages/profile-owner-edit/profile-owner-edit';
import { AlertScreen } from '../providers/services/alertScreen.service';
import { ApiProvider } from '../providers/api/api';
import { SUCCESS_STATUS, ERROR_STATUS, ACCESS_DENIED, TypeTabIndex , TypePush} from '../constants/config';
import { LoadingScreenProvider } from '../providers/services/loadingScreen.service';
import { ProfileOwnerSettingsPage } from '../pages/profile-owner-settings/profile-owner-settings';
import { ProfileOwnerSupportPage } from '../pages/profile-owner-support/profile-owner-support';
import { Events } from 'ionic-angular';
import { ProfilePersonPage } from '../pages/profile-person/profile-person';
import { SocketProvider } from '../providers/services/socket.service';
import { ShareProvider } from '../providers/services/share.service';
import { PushNotificationComponent } from "../components/push-notification/push-notification";
import { ConversationPage } from './../pages/conversation/conversation';
import { PushNotificationProvider } from './../providers/services/pushnotification.service';

import { Appsee } from 'cordova-plugin-appsee';

但如果我跑:

ionic serve

这最后一行会引发错误:

typescript: src/app/app.component.ts, line: 26 
    Cannot find module 'cordova-plugin-appsee'. 

如果我看这里:

https://www.appsee.com/docs/ios/ionic

文档表明这就是我要做的全部:

ionic cordova plugin add cordova-plugin-appsee
我已经完成了。

如果我这样做:

find . -name "*appsee*"

我明白这一点:

./plugins/cordova-plugin-appsee
./plugins/cordova-plugin-appsee/src/android/appsee.jar

如果我删除此行:

import { Appsee } from 'cordova-plugin-appsee';

然后我运行ionic serve然后应用程序启动而没有错误,但是当我尝试加载页面时,我得到:

Uncaught (in promise): ReferenceError: Appsee is not defined ReferenceError: Appsee is not defined at http://localhost:8100/build/main.js:6422:13 at t.invoke (http://localhost:8100/build/polyfills.js:3:9283) at Object.onInvoke (http://localhost:8100/build/vendor.js:4509:37) at t.invoke (http://localhost:8100/build/polyfills.js:3:9223) at r.run (http://localhost:8100/build/polyfills.js:3:4452) at http://localhost:8100/build/polyfills.js:3:14076 at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967) at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4500:37) at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888) at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)

我需要做些什么来完成这项工作?

此外,在之前的问题中,我链接到,有人把它放在评论中:

You need to test this on device or emulator. – Sampath Dec 5 '17 at 2:47

这是什么意思?

1 个答案:

答案 0 :(得分:0)

来自documentation

如果你正在使用TypeScript(在离子2和离子3中默认),请在导入下面添加以下行:

declare var Appsee:any;