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

rxjs requires rxjs-compat #3764

Closed
Pu4 opened this issue May 30, 2018 · 3 comments
Closed

rxjs requires rxjs-compat #3764

Pu4 opened this issue May 30, 2018 · 3 comments

Comments

@Pu4
Copy link

Pu4 commented May 30, 2018

Hi.
I'm trying to upgrade my angular app to fresh version using steps from this article
https://www.ngdevelop.tech/upgrade-angular-5-to-6/
Everything worked fine, after running rxjs-5-to-6-migrate command linter found and fixed some issues, ng serve worked as well. But after I removed rxjs-compat I got one error

ERROR in node_modules/rxjs/Rx.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat'.

This is the only error in console, Rx.d.ts file contains single line of code

export * from 'rxjs-compat';

Removing and reinstalling all packages from node_modules also didn't worked.
Am I doing something wrong?

Additional information:
package.json

{
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor",
    "build-with-ngsw-fix": "ng build --prod && npm run ngsw-fix-windows",
    "ngsw-fix": "yes | cp -rf src/ngsw-worker.js dist/",
    "ngsw-fix-windows": "copy src\\ngsw-worker.js dist /y",
    "ngsw-config": "node_modules/.bin/ngsw-config dist src/ngsw-config.json",
    "ngsw-copy": "cp node_modules/@angular/service-worker/ngsw-worker.js dist/",
    "build-prod-ngsw": "ng build --prod && npm run ngsw-config && npm run ngsw-copy",
    "serve-prod-ngsw": "npm run build-prod-ngsw && http-server dist -p 8080"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/schematics": "0.0.40",
    "@angular/animations": "^6.0.3",
    "@angular/common": "^6.0.3",
    "@angular/compiler": "^6.0.3",
    "@angular/core": "^6.0.3",
    "@angular/forms": "^6.0.1",
    "@angular/http": "^6.0.3",
    "@angular/platform-browser": "^6.0.3",
    "@angular/platform-browser-dynamic": "^6.0.3",
    "@angular/platform-server": "^6.0.3",
    "@angular/router": "^6.0.3",
    "@angular/service-worker": "^6.0.3",
    "@types/jquery": "^3.3.2",
    "@types/underscore": "^1.8.8",
    "bootstrap": "3.3.7",
    "class-transformer": "^0.1.9",
    "core-js": "2.4.1",
    "font-awesome": "4.7.0",
    "hammerjs": "^2.0.8",
    "jquery": "3.1.1",
    "ngx-bootstrap": "^3.0.0",
    "ngx-color-picker": "4.5.0",
    "ngx-gallery": "^2.4.1",
    "primeng": "^6.0.0-alpha.1",
    "quill": "1.3.2",
    "rxjs": "^6.2.0",
    "rxjs-compat": "^6.2.0",
    "rxjs-tslint": "^0.1.4",
    "schematics": "^0.2.0",
    "screenfull": "3.0.2",
    "toastr": "2.1.2",
    "ts-helpers": "1.1.1",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.6.7",
    "@angular/cli": "^6.0.7",
    "@angular/compiler-cli": "^6.0.3",
    "@types/jasmine": "2.5.53",
    "@types/node": "8.0.7",
    "codelyzer": "^4.3.0",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "3.2.0",
    "karma": "1.4.1",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "0.2.0",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "protractor": "5.2.0",
    "ts-node": "2.0.0",
    "tslint": "^5.10.0",
    "typescript": "^2.7.2"
  }
}
@pitAlex
Copy link

pitAlex commented May 31, 2018

rxjs-compat is required if you do any import like rxjs/something ex :
import { Subject } from "rxjs/Subject".
A way to find out if anything you import is done "the old way" is by checking the file of the module your are importing.
For example in node_modules/rxjs/Subject.js you will find it wants rxjs-compat. But
import { Subject } from "rxjs" has its origin in the new structure. I had same problems because I had import "rxjs/add/operator/..."; in some places, so thats also another reason.

@arch-daemone
Copy link

It almost sounds like somewhere in your own code, you're importing from 'rxjs/Rx'. If that's the case, simply find where that import is, and replace it with an import from the new improved index (e.g. import {Observable} from 'rxjs';).

The thing is, you've already been over your code with the linter. So it sounds more like you have a dependency on a library that is importing from 'rxjs/Rx'. If the import isn't in your code, it's in your node_modules. If that's the case, you'll need to re-introduce rxjs-compat for now, and petition the author of the library to update to RxJS 6.

@Pu4
Copy link
Author

Pu4 commented May 31, 2018

@DaemonExMachina, thank you.
I found single rxjs/Rx import in one of the files and removed it. That solved my issue.

@Pu4 Pu4 closed this as completed May 31, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants