我已尝试按照以下配置使用Circle CI为我的角度项目设置CI: https://angular.io/guide/testing#configure-project-for-circle-ci
但是,当ng test
运行时,出现以下错误:
ERROR in src/app/account/login-form/login-form.component.ts(4,26): error TS2307: Cannot find module 'rxjs/Operators'.
在本地,如果我删除node_modules/
并运行npm install
,然后运行npm test
,则rxjs不会有任何问题。
我的package.json
:
"dependencies": {
"@angular/animations": "7.2.4",
"@angular/common": "7.2.4",
"@angular/compiler": "7.2.4",
"@angular/core": "7.2.4",
"@angular/forms": "7.2.4",
"@angular/http": "7.2.4",
"@angular/platform-browser": "7.2.4",
"@angular/platform-browser-dynamic": "7.2.4",
"@angular/platform-server": "7.2.4",
"@angular/router": "7.2.4",
"@ng-bootstrap/ng-bootstrap": "^4.0.2",
"@nguniversal/module-map-ngfactory-loader": "7.1.0",
"angularx-social-login": "^1.2.6",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^4.2.1",
"core-js": "^2.5.4",
"rxjs": "^6.4.0",
"zone.js": "^0.8.29"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "~7.3.0",
"@angular/compiler-cli": "7.2.4",
"@angular/language-service": "^7.2.4",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"bootstrap-sass": "3.4.0",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"typescript": "~3.2.4"
},
"optionalDependencies": {
"node-sass": "4.11.0",
"protractor": "~5.4.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"
}
login-form.component.ts
中令人反感的行:
import { Subscription } from 'rxjs';
import { finalize } from 'rxjs/Operators';
我可以在这里提供任何有用的资源,但我不知道有什么用。
答案 0 :(得分:2)
那是因为您应该从rxjs/operators
而不是rxjs/Operators
导入。