简体   繁体   English

rxjs /运算符:找不到模块

[英]rxjs/operators: can not find module

I import rxjs/operators like this: 我导入像这样的rxjs /运算符:

import { map } from 'rxjs/operators';

But that gives me the following error: 但是这给了我以下错误:

map is declared but it values is never read. map已声明但它的值永远不会被读取。 Cannot find module rxjs/operators 找不到模块rxjs /运算符

in Angular. 在Angular。

Please help. 请帮忙。

You are using rxjs version 5.0.0 so you have to import map operator like this :: 您正在使用rxjs版本5.0.0,因此您必须导入这样的地图运算符::

import "rxjs/add/operator/map";

If You are using rxjs version 6.0.0 then you can import like this :: 如果您使用的是rxjs版本6.0.0,则可以像这样导入::

 import { map } from 'rxjs/operators'

And if you want to use first method with rxjs version 6.0.0 then you have to install rxjs compat as mentioned in comment by @Sachilla 如果你想使用rxjs版本6.0.0的第一个方法,那么你必须安装rxjs compat,如@Sachilla评论中所述

暂无
暂无

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

相关问题 Angular 7 CI rxjs / Operators找不到模块 - Angular 7 CI rxjs/Operators cannot find module 错误:在Ionic Angular中找不到模块“rxjs / operators” - Error: Cannot find module “rxjs/operators” in Ionic Angular angular 13:找不到模块:错误:无法解析“rxjs/operators” - angular 13: Module not found: Error: Can't resolve 'rxjs/operators' 错误 TS2307:找不到模块“rxjs/Operators”Azure DevOps Angular 8 - error TS2307: Cannot find module 'rxjs/Operators' Azure DevOps Angular 8 我使用ionic-img-viewer来查看图像,但是它引发了找不到模块“ rxjs / operators”的错误 - i used ionic-img-viewer for viewing image but it raised Cannot find module “rxjs/operators” error 在angular-cli中创建新项目时找不到模块'rxjs / operators' - Cannot find module 'rxjs/operators' while creating new project in angular-cli Kendo Angular 4对等依赖性未满足,并且找不到模块“ rxjs / operators / combineLatest” - Kendo Angular 4 Unmet Peer Dependency and Cannot find module “rxjs/operators/combineLatest” 将 angular 7 升级到 8 成功,但核心找不到模块 rxjs? - Upgrade angular 7 to 8 successful, but core can't find module rxjs? 找不到模块..无法使用Angular6解析模块'rxjs / operators / toPromise - Module not found ..Cannot resolve module 'rxjs/operators/toPromise with Angular6 找不到模块'rxjs / subject / BehaviorSubject' - Cannot find module 'rxjs/subject/BehaviorSubject'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM