请在Angular 5上添加@ngModule注释错误

时间:2018-02-13 05:52:17

标签: android angularjs cordova typescript ionic-framework

我正在使用selectsearchable软件包,在添加它之后,它也可以在ionic cordova build android上在网络上正常工作。当试图在ionic cordova build android --prod中编译时,它会抛出一个错误

   Please add @Ngmodule Annotation

意外值'模块导入的D:/MdAshiff/Ionic/ionic/node_modules/ionic-select-searchable/source/select-searchable.module.d.ts'中的SelectSearchableModule             'AppModule in D:/MdAshiff/Ionic/ionic/src/app/app.module.ts'。请添加一个             @NgModule注释。

app.module.ts

    import { NgModule, ErrorHandler } from '@angular/core';
    import { IonicApp, IonicModule, IonicErrorHandler, NavController } from 'ionic-angular';
    import { Geolocation } from '@ionic-native/geolocation';
    import { AppMinimize } from '@ionic-native/app-minimize';
    import { OpenNativeSettings } from '@ionic-native/open-native-settings';
    import { MyApp } from './app.component';
    import { Ionic2RatingModule } from 'ionic2-rating';
    import { NativeStorage } from '@ionic-native/native-storage';
    import { SplashScreen } from '@ionic-native/splash-screen'
    import { CallNumber } from '@ionic-native/call-number';
    import { Push, PushObject, PushOptions } from '@ionic-native/push';
    import { LocalNotifications } from '@ionic-native/local-notifications';
    import { Diagnostic } from '@ionic-native/diagnostic';
    import { HomePage } from '../pages/home/home';
    import { BrowserModule } from '@angular/platform-browser';
    import { HttpModule } from '@angular/http';
    import { SelectSearchableModule } from 'ionic-select-searchable';

    @NgModule({
      declarations: [
        MyApp,
        HomePage   

      ],
      imports: [
          IonicModule.forRoot(MyApp),
          Ionic2RatingModule,
          BrowserModule,
          HttpModule,
          SelectSearchableModule

      ],
      bootstrap: [IonicApp],
      entryComponents: [
        MyApp,
          loginPage,
          dashboardPage,
          ActivitiesPage,
          InvoicePage,
          feedbackPage,
          samplePage,
          locationUpdatePage,
          scopeofworkPage,
          SchedulePage,
          waypointPage

      ],
      providers:
      [
          Geolocation,
          NativeStorage,
          OpenNativeSettings,
          CallNumber,
          Push,
          LocalNotifications,
          Diagnostic,
          {
              provide: ErrorHandler, useClass: IonicErrorHandler

          },
          SplashScreen,
          AppMinimize  ]
    })
    export class AppModule {}

tsconfig.json

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "angularCompilerOptions": {
    "skipTemplateCodegen": true,
    "skipMetadataEmit": false,
    "strictMetadataEmit": true,
    "annotationsAs": "decorators"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  },
  "paths": {
    "@angular/*": [
      "../node_modules/@angular/*"
    ]
  }
}

的package.json

**

{
  "name": "Md",
  "author": "",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve",
    "watch": "ionic-app-scripts watch"

  },
  "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",
    "@ionic-native/app-minimize": "^4.5.3",
    "@ionic-native/call-number": "^4.5.3",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/diagnostic": "^4.5.3",
    "@ionic-native/fcm": "^4.5.3",
    "@ionic-native/geolocation": "^4.5.3",
    "@ionic-native/local-notifications": "^4.5.3",
    "@ionic-native/native-storage": "^4.5.3",
    "@ionic-native/network": "^4.5.3",
    "@ionic-native/open-native-settings": "^4.5.3",
    "@ionic-native/push": "^4.5.3",
    "@ionic-native/secure-storage": "^4.5.3",
    "@ionic-native/splash-screen": "^4.5.3",
    "@ionic/storage": "2.1.3",
    "call-number": "^1.0.1",
    "cordova-android": "6.3.0",
    "cordova-ios": "4.2.0",
    "cordova-open-native-settings": "^1.5.0",
    "cordova-plugin-app-event": "~1.2.1",
    "cordova-plugin-appminimize": "^1.0.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-console": "1.0.5",
    "cordova-plugin-crosswalk-webview": "~2.4.0",
    "cordova-plugin-device": "1.1.4",
    "cordova-plugin-geolocation": "~2.4.3",
    "cordova-plugin-nativestorage": "~2.2.2",
    "cordova-plugin-network-information": "^1.3.4",
    "cordova-plugin-splashscreen": "~4.0.1",
    "cordova-plugin-statusbar": "2.2.1",
    "cordova-plugin-whitelist": "1.3.1",
    "cordova-windows": "4.4.2",
    "cordova.plugins.diagnostic": "^3.9.2",
    "de.appplant.cordova.plugin.local-notification": "^0.8.5",
    "ionic-angular": "3.9.2",
    "ionic-native": "2.4.1",
    "ionic-plugin-keyboard": "~2.2.1",
    "ionic-select-searchable": "^1.0.2",
    "ionic2-rating": "^1.2.2",
    "ionicons": "3.0.0",
    "mx.ferreyra.callnumber": "~0.0.2",
    "phonegap-plugin-push": "~2.1.2",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.8",
    "typescript": "2.4.2"
  },
  "description": "Ionic2Blank: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "-vs-binding": {
    "BeforeBuild": [
      "ionic:build"
    ]
  },
  "cordova": {
    "platforms": [
      "ios",
      "windows",
      "android"
    ],
    "plugins": {
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-geolocation": {},
      "cordova-plugin-nativestorage": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-network-information": {},
      "cordova-open-native-settings": {},
      "mx.ferreyra.callnumber": {},
      "de.appplant.cordova.plugin.local-notification": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-app-event": {},
      "cordova.plugins.diagnostic": {},
      "cordova-plugin-crosswalk-webview": {
        "XWALK_VERSION": "23+",
        "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
        "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
        "XWALK_MODE": "embedded",
        "XWALK_MULTIPLEAPK": "true"
      },
      "phonegap-plugin-push": {
        "SENDER_ID": "XXXXXXXXXXX"
      },
      "cordova-plugin-appminimize": {}
    }
  }
}

**

我经历过各种各样的解决方案,但有些我失踪了。下面添加了使用的版权细节

离子3 Cordova android:6.3.0 科尔多瓦:7.1.0

其余版本都在package.json文件中。任何解决方案?

1 个答案:

答案 0 :(得分:0)

此问题由作者修正:

将库更新为1.0.8

npm install ionic-select-searchable@1.0.8

https://github.com/eakoriakin/ionic-select-searchable-demo