Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with angular and rxjs 6 #42

Closed
DocLM opened this issue Mar 29, 2018 · 38 comments
Closed

Compatibility with angular and rxjs 6 #42

DocLM opened this issue Mar 29, 2018 · 38 comments
Labels

Comments

@DocLM
Copy link
Contributor

DocLM commented Mar 29, 2018

Angular 6 should be released on April. This package seems to be incompatible with Angular upgrade to RxJS 6

I test it with a sample project generated with ng new angular-test

"dependencies": {
  "@angular/animations": "^6.0.0-rc.0",
  "@angular/cdk": "^6.0.0-beta.5",
  "@angular/common": "^6.0.0-rc.0",
  "@angular/compiler": "^6.0.0-rc.0",
  "@angular/core": "^6.0.0-rc.0",
  "@angular/forms": "^6.0.0-rc.0",
  "@angular/http": "^6.0.0-rc.0",
  "@angular/material": "^6.0.0-beta.5",
  "@angular/platform-browser": "^6.0.0-rc.0",
  "@angular/platform-browser-dynamic": "^6.0.0-rc.0",
  "@angular/router": "^6.0.0-rc.0",
  "core-js": "^2.4.1",
  "material-community-components": "^2.6.8",
  "rxjs": "^6.0.0-beta.3",
  "zone.js": "^0.8.20"
},
"devDependencies": {
  "@angular/compiler-cli": "^6.0.0-rc.0",
  "@angular-devkit/build-angular": "~0.0.9",
  "typescript": "~2.7.2",
  "@angular/cli": "~6.0.0-beta.8",
  "@angular/language-service": "^6.0.0-rc.0",
  "@types/jasmine": "~2.8.6",
  "@types/jasminewd2": "~2.0.3",
  "@types/node": "~8.9.4",
  "codelyzer": "~4.1.0",
  "jasmine-core": "~2.99.1",
  "jasmine-spec-reporter": "~4.2.1",
  "karma": "~2.0.0",
  "karma-chrome-launcher": "~2.2.0",
  "karma-coverage-istanbul-reporter": "~1.4.1",
  "karma-jasmine": "~1.1.1",
  "karma-jasmine-html-reporter": "^0.2.2",
  "protractor": "~5.3.0",
  "ts-node": "~5.0.0",
  "tslint": "~5.9.1"
}

Running ng serve will throw the following errors

ERROR in node_modules/material-community-components/color-picker/color-picker.component.d.ts(4,10): error TS2305: Module '"angular-test/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/material-community-components/color-picker/color-picker.directives.d.ts(5,10): error TS2305: Module '"angular-test/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/material-community-components/color-picker/color-picker.service.d.ts(1,10): error TS2305: Module '"angular-test/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/material-community-components/timer-picker/timer-picker.component.d.ts(3,10): error TS2305: Module '"angular-test/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/material-community-components/timer-picker/timer-picker.directives.d.ts(3,10): error TS2305: Module '"angular-test/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
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'.

Maybe we need a branch to apply some changes for the upcoming release

@ranouf
Copy link

ranouf commented May 4, 2018

Same for me

@DocLM DocLM changed the title Compatibility with angular : 6.0.0-rc.0 and rxjs 6.0.0-beta Compatibility with angular and rxjs 6.0.0 May 5, 2018
@DocLM DocLM changed the title Compatibility with angular and rxjs 6.0.0 Compatibility with angular and rxjs 6 May 5, 2018
@Fyvel
Copy link

Fyvel commented May 5, 2018

npm i rxjs-compat should allow ng serve to work
In the other hand, the section "After the update" from https://update.angular.io/ shows how to migrate to rxjs 6

@ranouf
Copy link

ranouf commented May 7, 2018

Thanks, It works now :)

1 similar comment
@cnqiuxue
Copy link

cnqiuxue commented May 9, 2018

Thanks, It works now :)

@tiaguinho
Copy link
Owner

Version 3.0.0 released!
Thank you @DocLM for your contributions.

@etonyali
Copy link

etonyali commented May 9, 2018

npm install rxjs@6 rxjs-compat@6 --save will do the trick!

@mandarini
Copy link

Thank you!! I saved so much time!

@z778856
Copy link

z778856 commented May 15, 2018

Thx Fixed It

@mayursn
Copy link

mayursn commented May 22, 2018

Thanks it works for me @Fyvel

@hamedjbbri
Copy link

Thanks, It works ...

@meenakshi1969
Copy link

Thanks a lot .You saved my day:)

@roopeshkumar
Copy link

Thank you. That's helpful.

@yehia123
Copy link

yehia123 commented Jun 5, 2018

@etonyali Thank you works for me now, been stuck all day trying to figure it out!

@InSantoshMahto
Copy link

thanks dear

@nageshvengal
Copy link

now its working... thanks

@sheanWinston
Copy link

thanks alot

@evyros
Copy link

evyros commented Jun 26, 2018

Actually, the real solution is changing the import declaration.
For example, change this:

import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';

To this:
import { Observable, Subject } from 'rxjs';

rxjs-compat is unnecessary, you don't really need it from version 6 and above (according to official migration guide).

@dhanu1993
Copy link

thanks a lot. saved a lot of time

@jrosseel
Copy link

@evyros, the problem I have is that the import is not in my typings but in those of rxjs itself.

This is the error I get:
ERROR in node_modules/rxjs/observable/throw.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/observable/throw'.

The error occurs in node_modules/rxjs/. My version of rxjs is > 6.0.0. I therefore have no control to change that import in a sustainable way myself.

@afolachea
Copy link

@jrosseel I had the same issue, the rxjs migration tool missed to remove one import in my code.
import 'rxjs/observable/throw';
The usage was successfully replaced by throwError so I only had to remove the import manually and the error was gone.

@pedroolimpio
Copy link

thx a lot!

@Yascin081
Copy link

Thanks a Lot bro

@4F2E4A2E
Copy link

4F2E4A2E commented Jul 26, 2018

Hey, guys rxjs-compat is a nice workaround, but is anyone tracking the solution, being without the workaround for rxjs6 only projects?

@TahaSeckin
Copy link

Thanks you bro

@slam24
Copy link

slam24 commented Aug 20, 2018

Thanks, It works now 👍

@alevidcosta
Copy link

In my pursuit of rxjs-compat removal, i performed the steps below

npm install tslint@5.0.0
rxjs-5-to-6-migrate -p src/tsconfig.app.json
Running the automatic migrations. Please, be patient and wait until the execution completes.
child_process.js:644
throw err;
^

Error: Command failed: "C:\Users\Dcostas\AppData\Roaming\npm\node_modules\rxjs-tslint\node_modules.bin\tslint" -c "C:\Users\Dcostas\AppData\Roaming\npm\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.json" -p "src/tsconfig.app.json" --fix
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at migrate (C:\Users\Dcostas\AppData\Roaming\npm\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.js:18:34)
at Object. (C:\Users\Dcostas\AppData\Roaming\npm\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.js:25:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)

Seemed to me It couldnt find the tsconfig.app.js which was not present in the first place.

After removing rxjs-compat, i get the error below which ofcourse goes away when i install rxjs-compat@6.0.0

npm start
ERROR in [at-loader] ./node_modules/rxjs/Rx.d.ts:1:15
TS2307: Cannot find module 'rxjs-compat'.

@wallacethierre
Copy link

wallacethierre commented Aug 29, 2018

Thanks a lot. worked for me.

@ganganibhumika
Copy link

Thank you very much.It work for me.

@anmol-rodi
Copy link

Awesome it worked for me thanks

@Olivia593
Copy link

Actually, the real solution is changing the import declaration.
For example, change this:

import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';

To this:
import { Observable, Subject } from 'rxjs';

rxjs-compat is unnecessary, you don't really need it from version 6 and above (according to official migration guide).

I changed the import declaration to import {} from 'rxjs', it's still not working.

@yogeshpatil143
Copy link

npm install --save rxjs-compat

Its working for me

@suchidomelo
Copy link

suchidomelo commented Nov 26, 2018

ERROR in node_modules/angular5-social-login/auth.service.d.ts(1,10): error TS2305: Module '"D:/angular_project/myangular5/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'.

can someone help me with this error

@PandaTheCoder
Copy link

thanx @Fyvel it works for me

@yogeshpatil143
Copy link

npm i rxjs-compat

Please add these in root folder

@anilgadekar2805
Copy link

thanks #Fyvel , it work in my application

@MedHassona
Copy link

thanks budy

@amol-barshile
Copy link

npm install --save rxjs-compat
really thanks

@jobintweets
Copy link

npm install rxjs@6 rxjs-compat@6 --save

thank you so much. you saved me a lot of time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests