离子生成错误-意外的令牌,缺少适当的加载程序

Cip*_*ian 8 javascript ionic-framework

仅当我尝试访问特定页面(事件页面)时,才出现以下错误。所有其他页面都可以正常工作。抱歉,很长的帖子,但是我不知道该如何解决。我删除了ios和android platorms ionic cordova platform rm ios,清理了npm缓存,但是什么也没有。

奇怪的是,我清理了事件页面,删除了ios应用ionic cordova platform rm ios并将其添加回去... add ios。没有任何内容,<ion-header no-border [class]="headerBackgroundClass">即使我删除了,错误仍然显示[class]="headerBackgroundClass"。那是我清理npm缓存的时间。但是它仍然没有用

我不知道还能尝试什么。

我唯一能想到的就是将ionic webview更新为"cordova-plugin-ionic-webview": "^4.0.0",from"cordova-plugin-ionic-webview": "^1.1.19",

[12:48:28]  ionic-app-script task: "build" 
[12:48:28]  Error: ./src/pages/event/event Module parse failed: Unexpected token (1:0) You may need an appropriate 
            loader to handle this file type. | <ion-header no-border [class]="headerBackgroundClass"> | <ion-navbar> | 
            <ion-title *ngIf="showTitle == true"> @ ./src/pages/event/event.module.ts 9:0-36 @ ./src lazy @ 
            ./node_modules/ionic-angular/util/ng-module-loader.js @ ./node_modules/ionic-angular/module.js @ 
            ./node_modules/ionic-angular/index.js @ ./src/app/app.module.ts @ ./src/app/main.ts 
Error: ./src/pages/event/event
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <ion-header no-border [class]="headerBackgroundClass">
|   <ion-navbar>
|     <ion-title *ngIf="showTitle == true">
 @ ./src/pages/event/event.module.ts 9:0-36
 @ ./src lazy
 @ ./node_modules/ionic-angular/util/ng-module-loader.js
 @ ./node_modules/ionic-angular/module.js
 @ ./node_modules/ionic-angular/index.js
 @ ./src/app/app.module.ts
 @ ./src/app/main.ts
Run Code Online (Sandbox Code Playgroud)

package.json

"dependencies": {
    "@angular/animations": "5.2.10",
    "@angular/common": "5.2.10",
    "@angular/compiler": "5.2.10",
    "@angular/compiler-cli": "5.2.10",
    "@angular/core": "5.2.10",
    "@angular/forms": "5.2.10",
    "@angular/http": "5.2.10",
    "@angular/platform-browser": "5.2.10",
    "@angular/platform-browser-dynamic": "5.2.10",
    "@ionic-native/camera": "^4.11.0",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/crop": "^4.12.0",
    "@ionic-native/file": "^4.12.0",
    "@ionic-native/google-plus": "^4.20.0",
    "@ionic-native/image-resizer": "^4.12.0",
    "@ionic-native/in-app-browser": "^4.17.0",
    "@ionic-native/native-page-transitions": "^4.18.0",
    "@ionic-native/onesignal": "^4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "^4.7.0",
    "@ionic/storage": "2.1.3",
    "angularfire2": "5.0.0-rc.6",
    "com.telerik.plugins.nativepagetransitions": "^0.6.5",
    "cordova-android": "7.1.4",
    "cordova-ios": "4.5.5",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-crop": "^0.4.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-googleplus": "7.0.0",
    "cordova-plugin-inappbrowser": "^3.0.0",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^4.0.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "firebase": "4.12.1",
    "info.protonet.imageresizer": "^0.1.1",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "moment": "^2.22.1",
    "onesignal-cordova-plugin": "^2.3.3",
    "rxjs": "5.5.10",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "config": {
    "ionic_source_map": "source-map"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.3",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "onesignal-cordova-plugin": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-crop": {},
      "info.protonet.imageresizer": {},
      "cordova-plugin-file": {},
      "cordova-plugin-inappbrowser": {},
      "com.telerik.plugins.nativepagetransitions": {},
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "xxx",
        "PLAY_SERVICES_VERSION": "11.8.0"
      }
    },
    "platforms": [
      "android",
      "ios"
    ]
Run Code Online (Sandbox Code Playgroud)

event.module.ts

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { EventPage } from './event';
import { SaferPipe } from '../../pipes/safer.pipe';
import { Underscore } from '../../pipes/underscore.pipe';
import { InAppBrowser } from '@ionic-native/in-app-browser';
import { NativePageTransitions } from '@ionic-native/native-page-transitions';
import { DaysPipe } from '../../pipes/days.pipe';

import { HourPipe } from '../../pipes/hour.pipe';

@NgModule({
  declarations: [
    EventPage,
    SaferPipe,
    Underscore,
    DaysPipe,
    HourPipe
  ],
  providers: [
    InAppBrowser,
    NativePageTransitions
  ],
  imports: [

    IonicPageModule.forChild(EventPage),
  ],
})
export class EventPageModule { }
Run Code Online (Sandbox Code Playgroud)

编辑***

使用解决方法使其正常工作。创建了一个新组件,并对代码进行了较小的更改。现在一切正常。不知道是什么导致了错误。

Cip*_*ian 0

使用解决方法让它工作。创建了一个新组件并移动了代码并进行了微小的更改。现在一切正常了。不确定是什么导致了错误。