0

Actually, I got this error in my cmd. My nodejs is the latest version. When I clone my angular 4 project to cli I got this error:

ERROR in node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find 
    module 'rxjs-compat/Observable'.
    src/app/EnquiryDetails/EnquiryDetails.Service.ts(9,10): error TS2305: Module 
    '"E:/newfolder/cli/cli/node_modules/rxjs/Observable"' has no exported member 
    'Observable'.
    src/app/EnquiryDetails/EnquiryDetails.Service.ts(27,14): error TS2339: 
    Property 'map' does not exist on type 'Observable<Response>'.

Here is my package.json:

"private": true, 
"dependencies": { 
    "@angular/animations": "^6.0.2", 
    "@angular/common": "^6.0.2", 
    "@angular/compiler": "^6.0.2", 
    "@angular/core": "^6.0.2", 
    "@angular/forms": "^6.0.2", 
    "@angular/http": "^6.0.2", 
    "@angular/platform-browser": "^6.0.2", 
    "@angular/platform-browser-dynamic": "^6.0.2", 
    "@angular/router": "^6.0.2", 
    "core-js": "^2.5.4", 
    "rxjs": "^6.0.0", 
    "zone.js": "^0.8.26"
},
10
  • Isn't rxjs-compat for angular 6? You might want to try a lower version, maybe rxjs5? Commented May 24, 2018 at 10:05
  • @rrd i am using angular 4 shall i downgrade the nodejs Commented May 24, 2018 at 10:08
  • Could you share with us the dependencies in your package.json file? Commented May 24, 2018 at 10:27
  • It's fully upgraded to ng6. Commented May 24, 2018 at 10:36
  • @JeffreyRoosendaal then how to slove? Commented May 24, 2018 at 10:38

1 Answer 1

4

Angular-cli uses Angular 6 and RxJS6, so you need to add compatibility with 4/5 through rxjs-compat:

npm i rxjs-compat

When upgrading to Angular 6, you can use the upgrade guide from the Angular team. I've used it too, and it works very well.

Sign up to request clarification or add additional context in comments.

4 Comments

actually i m using angular 4 is it change to 6?
Yes, Angular-cli uses Angular 6. Which version of angular-cli did you upgrade to?
i want angular 4 ?
I upgraded from 4 to 6 about 2 weeks ago, with the release of ng6, and it wasn't very hard. For a medium sized app, it took me just a few hours, and most of the problems came from the new RxJS, which can be solved by the rxjs-compat. I really recommend upgrading, but if you really don't want to, you can check for older versions of angular-cli I guess.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.