Hello, i have migrated mi app from Angular 4 to Angular 5. I am getting this error:
__WEBPACK_IMPORTED_MODULE_0__angular_core__.OpaqueToken is not a constructor
in toastr-module.js
[HMR] connected client.js
[HMR] bundle has 1 warningsclient.js
./node_modules/toastr-ng2/toastr-module.js
"export 'OpaqueToken' was not found in '@angular/core'
I am using:
Angular CLI: 1.5.0
Node: 8.9.0
OS: win32 x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
@angular/ cdk: 5.0.0-rc0
@angular/ cli: 1.5.0
@angular/ material: 5.0.0-rc0
@angular-devkit/ build-optimizer: 0.0.33
@angular-devkit/ core: 0.0.20
@angular-devkit/ schematics: 0.0.35
@ngtools/ json-schema: 1.1.0
@ngtools/ webpack: 1.8.0
@schematics/ angular: 0.1.3
typescript: 2.6.1
webpack-hot-middleware: 2.19.1
webpack-merge: 4.1.0
webpack: 3.6.0
and
toastr-ng2: "^4.1.1",
Please advise on what's going on.
Update to the latest version of ngx-toastr. The latest version 6.5.0 doesn't use OpaqueToken (removed from Angular 5)
Uninstall toastr-ng2. That is the old package name and shouldn't be used anymore. It has since been renamed to ngx-toastr.
Install ngx-toastr@latest which should solve your issue.
Issue solved, thank you @yarrgh.
Most helpful comment
Update to the latest version of ngx-toastr. The latest version 6.5.0 doesn't use OpaqueToken (removed from Angular 5)
Uninstall toastr-ng2. That is the old package name and shouldn't be used anymore. It has since been renamed to ngx-toastr.
Install
ngx-toastr@latestwhich should solve your issue.