TypeError:readFile $(...)。mergeMap不是Firebase服务函数中的函数

时间:2018-08-29 17:42:41

标签: angular firebase angular-ui-router google-cloud-functions serverside-rendering

我遵循了Angular Universal的指南:如Angular的官方文档中所述的服务器端渲染: https://angular.io/guide/universal 我设法正确地运行了具有2个捆绑软件,浏览器和服务器捆绑软件的应用程序。 我也按照视频的步骤进行操作:Angular Universal和Firebase Hosting。我还观看了视频:使用TypeScript的Firebase云功能入门。 我使用angular-universal-express-firebase模块在firebase函数中运行应用程序,而当我运行firebase函数服务时,出现此错误:

TypeError: readFile$(...).mergeMap is not a function
at ProjectPath\functions\node_modules\angular-universal-express\index.js:36:14
at Layer.handle [as handle_request] (ProjectPath\functions\node_modules\express\lib\router\layer.js:95:5)
at next (ProjectPath\functions\node_modules\express\lib\router\route.js:137:13)
at Route.dispatch (ProjectPath\functions\node_modules\express\lib\router\route.js:112:3)
at Layer.handle [as handle_request] (ProjectPath\functions\node_modules\express\lib\router\layer.js:95:5)
at ProjectPath\functions\node_modules\express\lib\router\index.js:281:22
at param (ProjectPath\functions\node_modules\express\lib\router\index.js:354:14)
at param (ProjectPath\functions\node_modules\express\lib\router\index.js:365:14)
at Function.process_params (ProjectPath\functions\node_modules\express\lib\router\index.js:410:3)
at next (ProjectPath\functions\node_modules\express\lib\router\index.js:275:10)

我的package.json文件中有这个

"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/cdk": "^6.0.2",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/flex-layout": "^5.0.0-beta.14",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/material": "^6.1.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/platform-server": "^6.1.3",
"@angular/router": "^6.0.0",
"@nguniversal/express-engine": "^6.1.0",
"@nguniversal/module-map-ngfactory-loader": "^6.0.0",
"@toverux/ngx-sweetalert2": "^4.0.0",
"angular-universal-express-firebase": "0.0.4",
"angularfire2": "^5.0.0-rc.11",
"core-js": "^2.5.4",
"express": "^4.16.3",
"firebase": "^5.3.0",
"firebase-admin": "~6.0.0",
"firebase-functions": "^2.0.5",
"hammerjs": "^2.0.8",
"ngx-toastr": "^8.10.0",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.2.0",
"sweetalert2": "^7.21.1",
"zone.js": "^0.8.26"

},

"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular-devkit/schematics": "^0.7.5",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"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",
"protractor": "~5.3.0",
"ts-loader": "^4.5.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2",
"webpack-cli": "^3.1.0"

},   “私人”:true

你能帮我吗? 我究竟做错了什么? 拜托。

1 个答案:

答案 0 :(得分:0)

.mergeMap不再是rxjs 6中Observable上的函数。

您需要使用.pipe,然后像这样导入mergeMap

import { mergeMap } from 'rxjs/operators';

// ...

myObservable.pipe(
    mergeMap((id) => newObservable(id)) 
)