node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/rxjs/Observer.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observer'.
node_modules/rxjs/ReplaySubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/ReplaySubject'.
node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat'.
node_modules/rxjs/Subject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subject'.
node_modules/rxjs/Subscriber.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscriber'.
node_modules/rxjs/Subscription.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subscription'.
node_modules/rxjs/observable/forkJoin.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/observable/forkJoin'.
node_modules/rxjs/observable/from.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/observable/from'.
node_modules/rxjs/operators/map.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/operators/map'.
node_modules/rxjs/operators/startWith.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/operators/startWith'.
RxJS version:
Code to reproduce:
Expected behavior:
Actual behavior:
Additional information:
With the issue including neither the version information nor the code that effects the errors, it's not possible to say precisely what the problem is. That's why the issue template should be filled out.
However, those sorts of errors will be effected if v5-style imports are used when rxjs v6 is installed without rxjs-compat also being installed. It's explained in the migration guide.
I am facing same issue. Installed rxjs 6 and in Observable.d.ts there is an import
export * from 'rxjs-compat/Observable';
which causes the error
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
so do i need to install rxjs-compat always?
btw when i try to run migration script:
Command failed: ..pathnode_modulesrxjs-tslintnode_modules.bin\tslint -c ...pathnode_modulesrxjs-tslintrxjs-5-to-6-migrate.json -p [C:...pathg.../tsconfig.json] --fix
I am facing same issue after angular 6 update.
@vytautas-pranskunas- @sachinpachori The errors disappeared for me when I've updated the import paths according to the migration guide: https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#import-paths
rxjs-tslint isn't picking up the migration changes necessary in rxjs
and inside of Observable.d.ts, why do we need to export * from 'rxjs-compat/Observable if the goal is to relieve our reliance on rxjs-compat?
I have rxjs 6.1.0 installed and after running the migration tool and using the rxjs-tslint I get the same error. Obviously if I add back the rxjs-compat node module, this error disappears and everything compiles fine.
ERROR in node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ â–³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.0.0
Node: 9.2.0
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@angular/cdk 6.0.1
@angular/material 6.0.1
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
I am also facing the same problem.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
@SnakeME In my case it didn't and I need to keep the rxjs-compat to get it working locally however now my build definition is failing and I am looking at it.
In the meantime, a quick fix for me was to roll back to 5.x:
npm install --save [email protected]
for me npm install rxjs@6 rxjs-compat@6 --save did the trick, i dont know if this might help someone else,
i found it here
reinstalling rxjs and rxjs compat did the trick for me. "npm install --save rxjs@6 rxjs-compat@6".
Problem is that rxjs-compat@6 will be depricated in v7. So question is if I want to remove rxjs-compat@6 how should i do this. To tell the truth i do not have it at the moment also so question is what should i do not depend on it - but not how to get rid of just that error.
If you want just to ged rid of error add to typescript config skipLibCheck: true.
I have cleaned the code and got it work. I avoid using rxjs-compat as well. Thanks.
Have you released new version with cleaned code?
@Mrcampbell it's not possible to downgrade rxjs to 5.5.10 because this version is not supported by Angular v6 .
how come these obvious issues not caught before releasing Angular6?
This shouldn't be closed until the fix is in.
This happens when you haven't updated other imports that require Subject etc. from the old location. Update the other imports in your other files and these will go away.
@Son-Lam how did you exactly fix this though?
@jamesclark92 Check your import paths https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#import-paths
When you have updated them the error should disappear.
@jamesclark92 Yes I know, for me the errors disappeared when I've corrected the imports in my TypeScript files. It seems like rxjs is doing some kind of fallback or check when it detects that you are using an old import statement.
I stand corrected with the error I was getting, the culprit was a package dependency that was using rxjs/Observable import. As soon as I updated to a more recent version that supported rxjs 6, the error went away and I was able to drop the rxjs-compat package.
npm install --save rxjs@6 rxjs-compat@6
In order to minimize the impact of the upgrade, RxJS v6 releases with a sibling package, rxjs-compat, which provides a compatibility layer between the v6 and v5 APIs. Most developers with existing applications should upgrade by installing both rxjs and rxjs-compat at ^6.0.0:
npm install rxjs@6 rxjs-compat@6 --save
@dimkanewtown thanks for your last comment, how exactly did you determine which dependency was the culprit in your app? I have many dependencies that could be involved - do you have a quick way to find the needle in the haystack?
@tobyStaff in my case I only had a few dependencies which I was able to check manually
In my case it turned out that the @angular/flex-layout package I was using depended on rxjs-compat. I upgraded to the latest version and the problem went away.
So in summary this is what I did:
rxjs-compat. We will need this temporarily. Otherwise rxjs-5-to-6-migrate won't run as long as you have compilation errors.rxjs-tslint.rxjs-5-to-6-migrate to migrate your code to RxJs 6.Observable is now imported form rx module.rxjs-compat. We should not need this any more.So many people keep repeating the reply to install the rxjs-compat package, as if one reply isn't enough!
rxjs-campat is going to significantly increase the bundle size...
It's made to temporarily arrange compatibility between old rxjs 5.2 syntax and the new 6.0 update.
Thus, the last step of the rxjs 6.0 update is to remove the compatibility package.
The errors mentioned by the gentleman who created the post are specific to the rxjs library code, and it is a valid github issue which needs to be fixed.
@sssalib42 actually I don't think it is an issue with rxjs itself. I made the same mistake as countless others in thinking that it was. In reality, this is only an issue when you have code (be it yours or a third party library) that is using the old style imports. If all of your code uses the new style rxjs imports this is not an issue. In fact, it's working exactly as intended.
On 24 May 2018, at 16:26, sssalib42 <[email protected]notifications@github.com> wrote:
So many people keep repeating the reply to install the rxjs-compat package, as if one reply isn't enough!
rxjs-campat is going to significantly increase the bundle size...
It's made to temporarily arrange compatibility between old rxjs 5.2 syntax and the new 6.0 update.
Thus, the last step of the Angular update is to remove the compatibility package.
The errors mentioned by the gentleman who created the post are specific to the rxjs library code, and it is a valid github issue which needs to be fixed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/ReactiveX/rxjs/issues/3654#issuecomment-391756285, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALKxV1F6oIG8H61VZIOnuitLpuzxazhhks5t1tE3gaJpZM4Tz_-d.
@jamesclark92 Not agreeing. I do not have any old import code and i am fully on Angular 6 but i do have this error when libCheck is enabled because rxjs Observable.d.ts has a line
export * from 'rxjs-compat/Observable';
And there is no how you can change or idsable it. This is 100% issue of rxjs
Guys, you have this issue because either you have a import {Observable} from "rxjs/Observable" in your project (which is deprecated and you have to replace it to import {Observable} from "rxjs" OR install rxjs-compat library.
If you don't have in your code import {Observable} from "rxjs/Observable" but still have this error, it means some of third-party library you are using still use such import. Find a module that use it and create an issue on their git repository or update library version if they already have made a fix.
Is there any way to fix the imports done by third party plugins without having to wait for new versions?
Something like a custom minimal rxjs-compat.
I have a situation where everything is rxjs6 compatible, except two imports in a third party plugin. Just Observable and Subject, no other operators or classes.
rxjs-compat is already kinda minimal and there is no point in developing multiple other versions. Simply install rxjs-compat and use it.
From my understanding, installing rxjs-compat removes all benefits you could gain from tree-shaking. It bundles the entire rxjs library, even if you use just some parts.
In my case, with rxjs-compat main.js is 691 KB, without it (and a patched library import) it's 671 KB.
I know this sounds like a small difference, but since tree-shake-ability is listed as reason number 2 (and 3) for the recent change in API, I'd like to be able to benefit from it.
If I find a way to achive this, I'll post it here, but I'm not going to invest a lot of time in searching for this, as it is a small difference at the moment.
I've managed to get a smaller rxjs-compat working in an Angular project using paths in tsconfig to override the needed imports
Running rxjs-5-to-6-migrate (as mentioned by @bibhas2) on my project (described here - https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md) fixed the problem for me.
package zone.js is not rxjs 6 compatible. There is an open issue : https://github.com/angular/zone.js/issues/1091. Next release will probably correct that.
I was having this error:
_ERROR in node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat'._
I fixed it after finding the following import statement in app.module.ts.
_import 'rxjs/Rx';_
Upgrading 3rd party packages was part of the solution but search your code for "rxjs/" and you may find your issue like I did.
Update:
I confirm that I did find 'rxjs/Rx' imports that were not covered by the rxjs 6 linting tool.
Perhaps this needs to be addressed by the folks testing and developing the rxjs linting tool?!
Also, after updating a third party library which was still using old rxjs5 syntax, the list of errors related to its files disappeared.
Unfortunately, not all the libraries which we're using in our project has updated to rxjs 6 syntax, so I'm stuck with rxjs-compat until they are all up to date.
Thanks.
this is because what version you are using of Angular CLI is V6 and what project you are using is of V5 or less than that.
we need ti install rxjs and rxjs-compat packages to use the Observable.
I got fixed issue by using "npm install rxjs@6 rxjs-compat@6 --save".
had the same issue when updated my project to angular 6. Got fixed by using "npm install rxjs@6 rxjs-compat@6 --save".
@pleerock "import { Observable } from 'rxjs'; " worked for me thank you.
npm install --save rxjs-compat@6 did the trick.
Thanks guys!
Still not working on my side!
Here is my lite-server output:
[1] 18.07.26 12:48:37 404 GET /node_modules/rxjs/
[1] 18.07.26 12:48:37 404 GET /node_modules/rxjs/operators.js
Can someone provide a full explanation ?
Hello all, not sure why this issue is closed. Installing npm install --save rxjs-compat is a not a solution because our solution may not require this package. This either needs to be dependency of RxJs or corrected such that it is not affecting out code. Is there any update on this?
Summary:
Is this issue to be fixed by rxjs team?
No.
Why am I getting this error then?
Your own written code, and/or code in npm packages you installed in your project is still using old rxjs 5 code syntax.
What if I searched all my code and I don't find reference to old rxjs 5 syntax, but still getting this error?
One of your npm packages in the node_modules folder is still using the syntax. You can open the package.json file included in suspected packages node_modules folder and read their rxjs dependency version.
Will installing rxjs-compat fix this issue, as suggested by many comments here?
Yes, but this shouldn't be considered a final solution, as this compatibility package was designed to aid you upgrade slowly by allowing both rxjs 5 and 6 to run along side until you completely remove all old rxjs 5 code from your project. The compatibility package (rxjs-compat) increases the website JavaScript bundle size, and must be removed as a final step in your migration process.
How do I upgrade my code to rxjs 6 syntax appropriately?
In a nutshell, you will need to follow these two steps:
1-Run a migration tool (rxjs-5-to-6-migrate -p <config file>) created by the rxjs team that will parse your entire code and update your import statements and pipe structure for you. For this step it's possible you may need to do some googling to resolve a couple of manual handling of special cases, only if you get compilation errors, but there is good conversations on stack overflow to guide you through any potential errors.
2- You will need the rxjs compatibility package until you have completely removed all rxjs 5 code from your project then you should remove the compatibility package because otherwise it increases the bundle size of your website, which negatively affects the performance of your website.
Here are two good valuable resources:
https://github.com/ReactiveX/rxjs/blob/master/docs_app/content/guide/v6/migration.md
https://auth0.com/blog/whats-new-in-rxjs-6/
Good Luck.
yarn add [email protected] [email protected] --S --E followed by 'yarn install' will fix.
reinstalling rxjs and rxjs compat did the trick for me. "npm install --save rxjs@6 rxjs-compat@6".
For those that are struggling to get rid of the ERROR in node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat'. after you remove the compatibility layer....
All the people telling you to fix your paths are correct, but it would be better if they told you how to find them... I spent hours going through my code and couldn't find anything wrong:
What Worked: Go to node_module/rxjs/Rx.d.ts and "TEMPORARILY" comment out export * from 'rxjs-compat';
Now do an ionic build, and all the bad paths will be in the build errors. In my case it was an import 'rxjs/Rx'; statement.
When you get rid of the bad paths, change your node_module/rxjs/Rx.d.ts back to the original, and ionic build will now work.
Hi guys
in rxjs 5 always use import { Observable } from 'rxjs/Observable';
but in rxjs 6 you should use import { Observable } from 'rxjs';
I hope it is help
this worked for me: https://github.com/ReactiveX/rxjs/issues/3654#issuecomment-388099814
npm i rxjs-compat
this works for me.....
I have the same issue with rxjs-compat.
currently i'm using Angular 6 .
my rxjs version 6.2.2 , yes after installing the rxjs-compat everything is working fine but is there any other solution without installing rxjs-compat
ERROR in node_modules/ngx-editor/app/ngx-editor/common/services/message.service. d.ts(1,10): error TS2305: Module '"C:/Users/frontend/node_modules/rx js/Observable"' has no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs- compat/Observable'.
rxjs-compat (compatibility package) is to temporarily let you use old rxjs 5 syntax code along side rxjs 6.
You will need to remove it as a final step in your upgrade process.
Have you used https://update.angular.io/?
Particularly, the "After The Update" section, it includes detailed steps on how to upgrade from rxjs 5 to rxjs 6.
Guys, beware!
Zone.js library has NOT updated their code to RxJS 6, yet!!
https://github.com/angular/zone.js/pull/1122
My team is waiting on their RxJS 6 update PR to be merged before we are able to get rid of the rxjs-compat (comparability) package.
This is an example of how relying on a major library can stop hundreds of projects from upgrading! smh
What solved it for me was removing this import from all places:
import 'rxjs/Rx';
Most helpful comment
for me
npm install rxjs@6 rxjs-compat@6 --savedid the trick, i dont know if this might help someone else,i found it here