实际上,我的cmd中出现了这个错误。我的nodejs是最新版本。当我将我的角度4项目克隆到cli时,我收到了这个错误:
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>'.
这是我的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"
},
答案 0 :(得分:4)
Angular-cli使用Angular 6和RxJS6 ,因此您需要通过rxjs-compat添加与4/5的兼容性:
npm i rxjs-compat
升级到Angular 6时,您可以使用the upgrade guide from the Angular team。我也使用过它,效果很好。