简体   繁体   English

node_modules/ng2-toastr/src/toast-container.component.d.ts(1,48) 中的错误:TS2305-/node_modules/@angular/core/core"' 没有导出成员

[英]ERROR in node_modules/ng2-toastr/src/toast-container.component.d.ts(1,48): TS2305- /node_modules/@angular/core/core"' has no exported member

I have the latest version of "rxjs": "^6.0.0" and @angular/cli": "~6.0.8" When i run ng serve i am receiving below compilation error-我有最新版本的"rxjs": "^6.0.0"@angular/cli": "~6.0.8"当我运行ng serve我收到以下编译错误-

ERROR in node_modules/ng2-toastr/src/toast-container.component.d.ts(1,48): 
 /node_modules/@angular/core/core"' has no exported member'AnimationTransitionEvent'.

imported toastermodule in the below format in my app.module.ts
import {ToastrModule} from 'ngx-toastr';

Also receiving below error还收到以下错误

error TS2305: Module '"C:/Users/user1/Sublime Text 3/NodeJS/groupchat-application/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
imported as below in  My service.ts
import { Observable, of} from "rxjs"; 

Please guide on how to proceed请指导如何进行

Use **ngx-toastr**

**steps to follow**

Install dependencies 

1)npm install ngx-toastr --save
2)npm install @angular/animations --save

3)Add CSS to your angular.json file
"styles": [
  "styles.scss",
  "node_modules/ngx-toastr/toastr.css" // try adding '../' if you're using angular cli before 6
]

4)Add toastr module to your app.module.ts
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';

@NgModule({
  imports: [BrowserAnimationsModule,
    ToastrModule.forRoot() 
})

5) Add toastr service to your desired component 

import { ToastrService } from 'ngx-toastr';

@Component({...})
export class YourComponent {
  constructor(private toastr: ToastrService) {}

  showSuccess() {
    this.toastr.success('Hello world!', 'Toastr fun!');
  }
}

You use "rxjs": "^6.0.0" and ng2-toastr: uses rxjs below 6.0.0 so compatibiliy issue is there.您使用 "rxjs": "^6.0.0" 和 ng2-toastr: 使用低于 6.0.0 的 rxjs,因此存在兼容性问题。 You have two options to use:您有两种选择:

  1. rxjs-compat with rxjs 6.0.0 rxjs-compatrxjs 6.0.0

  2. Else use ngx-toasta [link]否则使用ngx-toasta [链接]

Edit: Due to the update of angular and its dependency not in sync and if you are using angular material 6+ then you can go for @angular/material Snackbar which is better compatible with the latest version of Angular.编辑:由于 angular 的更新及其依赖性不同步,如果您使用的是 angular material 6+,那么您可以选择 @angular/material Snackbar,它与最新版本的 Angular 兼容更好。

i was able to solve this problem using我能够使用解决这个问题

        npm install ng6-toastr-notifications --save

a good documentation link is available.i will provide u the link提供了一个很好的文档链接。我会为您提供链接

https://www.npmjs.com/package/ng6-toastr-notifications https://www.npmjs.com/package/ng6-toastr-notifications

This probleme is due to toastr and animation comptabilty with your angular version !这个问题是由于 toastr 和动画与你的角度版本兼容!

   ngx-toastr   Angular
    6.5.0       4.x
    8.10.2      5.x
    10.1.0      8.x 7.x 6.x
    11.3.3      8.x
    12.1.0      9.x
   current  >= 10.x

try those version for your case:为您的情况尝试这些版本:

first uninstall both toastr and animation if you have them in your project the run those ones:如果您的项目中有 toastr 和动画,请先卸载它们,然后运行它们:

npm install ngx-toastr@10.0.4 --save npm 安装 ngx-toastr@10.0.4 --保存

npm install @angular/animations@8.2.14 --save npm install @angular/animations@8.2.14 --保存

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误TS2305:模块“ / node_modules / rxjs / Rx”没有导出的成员“可订阅” - error TS2305: Module “/node_modules/rxjs/Rx” has no exported member 'Subscribable' ionic serve在“node_modules/@angular/core/src/render3/definition.d.ts”中有Typescript Error - ionic serve has Typescript Error at “node_modules/@angular/core/src/render3/definition.d.ts” node_modules/@fullcalendar/core/main.d.ts(1196,54) 中的错误:错误 TS1144:'{' 或 ';' 预期的 - ERROR in node_modules/@fullcalendar/core/main.d.ts(1196,54): error TS1144: '{' or ';' expected ../node_modules/@types/node/assert.d.ts:3:68 中的错误 - 错误 TS1144: '{' or ';' 预期的 - ERROR in ../node_modules/@types/node/assert.d.ts:3:68 - error TS1144: '{' or ';' expected 如何修复Angular 2错误的node_modules/@types/systemjs/index.d.ts(333,13)? - How to fix node_modules/@types/systemjs/index.d.ts (333,13) of Angular 2 error? Angular 7 node_modules/graphql-tag/lib/index.d.ts(2,57) 中的错误:错误 TS1005:“,”预期 - Angular 7 ERROR in node_modules/graphql-tag/lib/index.d.ts(2,57): error TS1005: ',' expected ProviderError:HttpProvider.request 处的 HttpProviderError(.../node_modules/hardhat/src/internal/core/providers/http.ts:78:19) - ProviderError: HttpProviderError at HttpProvider.request (.../node_modules/hardhat/src/internal/core/providers/http.ts:78:19) 目录/node_modules/@antv/g6-core/lib/types/index.d.ts(24,37) 中的 TypeScript 错误:预期类型。 TS1110 - TypeScript error in directory/node_modules/@antv/g6-core/lib/types/index.d.ts(24,37): Type expected. TS1110 ../node_modules/ng2-ckeditor/ckbutton 中的错误。 指令.d.TS:1:23 - 错误 TS2688:找不到“ckeditor”的类型定义文件 - ERROR in ../node_modules/ng2-ckeditor/ckbutton. directive.d.TS: 1:23 - error TS2688: Cannot find type definition file for 'ckeditor' node_modules/@types/lodash/common/array.d.ts(37,24) 中的错误:错误 TS1005:';' 预期的 - ERROR in node_modules/@types/lodash/common/array.d.ts(37,24): error TS1005: ';' expected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM