Nitneq
Nitneq

Reputation: 711

Ionic error : has no exported member OpaqueToken

I had an Ionic project who worked fine, but when I tried to install angular-fire (on a specific branch), I had to update some packages, and now the app doens't work. I have several Typescript errors like :

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'.

I made all my changes in a specific branch. But when I switch to an older branch, the error is still present.
I tried npm install --save-dev @angular/cli@latest(version 6.0.0). Ionic version is 3.20.0 .

I don't use OpaqueToken anywhere, I don't why I get it. I check several github issues or SO questions, but nothing works for me.

Here is my 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": {}
    }
  }
}

Has anyone had this problem ?

EDIT

After updating my packages as suggested below, I get this error :

enter image description here

I don't use SubscriptionLike anywhere. I tried to comment any rx import but it didn't change anything..

Upvotes: 1

Views: 2806

Answers (1)

ForestG
ForestG

Reputation: 18105

You should update everything to the new version of Angular (6.0).

See the official update guide for details.

I think your Typescript version should be at least 2.7.2, angular core 6.0, rxjs 6.1, and ionic latest.

Edit: install the rxjs-compat module for compatibility issues. Read the RxJS part from this blog to see why: basially RxJS6 changed the way to import it's members.

Upvotes: 1

Related Questions