“ src \ app \ app.module.ts(60,22)中的错误:'AppModule'的模板编译期间出错”,在使用cordova将离子应用构建到ios --prod时

时间:2019-07-18 05:46:34

标签: ionic-framework ionic3

我正在尝试将离子应用程序部署到appstore。但是我无法将此应用程序构建为--prod。部署测试构建时没有错误。请帮助我解决此问题。

我正在使用ionic 3框架。我创建了一个日历应用程序。这是我的第一个应用程序,因此我不知道要解决此问题。运行以下命令时出现错误

ionic cordova build ios --prod。

这是我的应用模块

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { HttpClientModule } from '@angular/common/http';
import { IonicStorageModule, Storage } from '@ionic/storage'; 
import { JwtModule, JWT_OPTIONS, JwtHelperService } from '@auth0/angular-jwt';
import { HTTP } from '@ionic-native/http/ngx';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { LoginPage } from './login/login.page';
import { HomePage } from './home/home.page';
import { UpdateEventPage } from './home/update-event/update-event.page';
import { AddMembersComponent } from './home/add-members/add-members.component';
import { ProfilePage } from './profile/profile.page';
import { NgCalendarModule } from 'ionic2-calendar';
import { IonicSelectableModule } from 'ionic-selectable';

export function jwtOptionsFactory(storage) {
  return {
    tokenGetter: () => {
      return storage.get('access_token');
    },
    whitelistedDomains: ['82.165.76.209:57', 'localhost:8100']
  }
}

@NgModule({
  declarations: [AppComponent, LoginPage, HomePage, UpdateEventPage, AddMembersComponent, ProfilePage],
  entryComponents: [UpdateEventPage, AddMembersComponent],
  imports: [
    BrowserModule, 
    IonicModule.forRoot(), 
    IonicStorageModule.forRoot(),
    HttpClientModule,
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    IonicModule,
    NgCalendarModule,
    IonicSelectableModule,
    JwtModule.forRoot({
      jwtOptionsProvider: {
        provide: JWT_OPTIONS,
        useFactory: jwtOptionsFactory,
        deps: [Storage],
      }
    }),
    AppRoutingModule,
  ],
  providers: [
    StatusBar,
    SplashScreen,
    JwtHelperService,, 
    HTTP,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

这是我的包json依赖项


  "dependencies": {
    "@angular/common": "^7.2.2",
    "@angular/core": "^7.2.2",
    "@angular/forms": "^7.2.2",
    "@angular/http": "^7.2.2",
    "@angular/platform-browser": "^7.2.2",
    "@angular/platform-browser-dynamic": "^7.2.2",
    "@angular/router": "^7.2.2",
    "@auth0/angular-jwt": "^2.1.0",
    "@capacitor/android": "^1.0.0-beta.19",
    "@capacitor/cli": "1.0.0-beta.19",
    "@capacitor/core": "1.0.0-beta.19",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/http": "^5.5.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.5.0",
    "@ionic/angular": "^4.1.0",
    "@ionic/pro": "2.0.4",
    "@ionic/storage": "^2.2.0",
    "cordova-android": "8.0.0",
    "cordova-ios": "5.0.1",
    "cordova-plugin-advanced-http": "2.0.9",
    "cordova-plugin-file": "6.0.1",
    "cordova-sqlite-storage": "3.2.0",
    "core-js": "^2.5.4",
    "ionic-selectable": "^4.4.0",
    "ionic2-calendar": "^0.5.2",
    "rxjs": "~6.4.0",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.13.8",
    "@angular-devkit/build-angular": "~0.13.8",
    "@angular-devkit/core": "~7.3.8",
    "@angular-devkit/schematics": "~7.3.8",
    "@angular/cli": "~7.3.8",
    "@angular/compiler": "~7.2.2",
    "@angular/compiler-cli": "~7.2.2",
    "@angular/language-service": "~7.2.2",
    "@ionic/angular-toolkit": "~1.5.1",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.14.2",
    "codelyzer": "~4.5.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^4.0.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~8.1.0",
    "tslint": "~5.16.0",
    "typescript": "~3.1.6"
  },

我收到以下错误。 src \ app \ app.module.ts(60,22)中的错误:模板编译“ AppModule”时出错   不支持表达形式。<​​/ p>

[ERROR]运行子进程ng时发生错误。

1 个答案:

答案 0 :(得分:0)

第60行有一个错字:

JwtHelperService,,

将此更改为:

JwtHelperService,