离子错误:没有导出的成员OpaqueToken

时间:2018-05-08 09:24:05

标签: angular ionic-framework

我有一个工作正常的Ionic项目,但是当我尝试安装angular-fire(在特定分支上)时,我不得不更新一些软件包,现在应用程序无法正常工作。我有几个Typescript错误,如:

node_modules/ionic-angular/config/config.d.ts, line: 1 Module '"/Users/toto/Desktop/myProject/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.

我在特定分支中进行了所有更改。但是当我切换到较旧的分支时,错误仍然存​​在。 我试过npm install --save-dev @angular/cli@latest(版本6.0.0)。离子版本是3.20.0。

我不在任何地方使用OpaqueToken,我不知道为什么我会这样做。我检查了几个github问题或SO问题,但没有什么对我有用。

这是我的package.json:

{
  "name": "My project name",
  "version": "0.1.3",
  "author": "Toto",
  "homepage": "www.toto.com",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@ionic-native/core": "^4.2.0",
    "@ionic-native/keyboard": "^4.5.3",
    "@ionic-native/screen-orientation": "^4.1.0",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "^4.7.0",
    "@ionic/storage": "2.0.1",
    "cordova-android": "~5.2.2",
    "cordova-ios": "^4.5.4",
    "cordova-plugin-device": "1.1.4",
    "cordova-plugin-hockeyapp": "^5.1.1",
    "cordova-plugin-ionic": "^2.0.3",
    "cordova-plugin-screen-orientation": "~2.0.1",
    "cordova-plugin-splashscreen": "~4.0.1",
    "cordova-plugin-statusbar": "2.2.2",
    "cordova-plugin-whitelist": "1.3.1",
    "ionic-angular": "3.6.0",
    "ionic-hockeyapp": "^0.2.0",
    "ionic-plugin-keyboard": "~2.2.1",
    "ionicons": "3.0.0",
    "rxjs": "5.4.0",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.12"
  },
  "devDependencies": {
    "@angular/cli": "^6.0.0",
    "@ionic/app-scripts": "2.1.3",
    "ionic": "3.16.0",
    "typescript": "2.3.4"
  },
  "description": "An Ionic project",
  "cordova": {
    "platforms": [
      "android",
      "ios"
    ],
    "plugins": {
      "cordova-plugin-device": {},
      "cordova-plugin-screen-orientation": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-hockeyapp": {}
    }
  }
}

有人有这个问题吗?

修改

按照以下建议更新我的软件包后,出现此错误:

enter image description here

我不在任何地方使用SubscriptionLike。我试图评论任何rx导入,但它没有改变任何东西..

1 个答案:

答案 0 :(得分:1)

您应该将所有内容更新为新版本的Angular(6.0)。

请参阅https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video_autoplay

我认为你的Typescript版本应至少为2.7.2,angular core 6.0,rxjs 6.1和ionic latest。

修改:安装official update guide for details模块以解决兼容性问题。阅读RxJS部分rxjs-compat以了解原因:基本上RxJS6改变了导入它的成员的方式。