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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了TypeError:readFile $(...).mergeMap不是firebase服务函数中的函数相关的知识,希望对你有一定的参考价值。

我遵循Angular Universal的指南:服务器端呈现,如Angular的官方文档中所述:https://angular.io/guide/universal我设法正确运行应用程序,包含2个软件包,浏览器和服务器软件包。我也按照视频的步骤进行操作:Angular Universal和Firebase Hosting。我还关注了视频:使用TypeScript开始使用Firebase的Cloud Functions。我使用angular-universal-express-firebase模块在firebase函数中运行应用程序,当我运行firebase服务函数时,我收到此错误:

TypeError: readFile$(...).mergeMap is not a function
at ProjectPathfunctions
ode_modulesangular-universal-expressindex.js:36:14
at Layer.handle [as handle_request] (ProjectPathfunctions
ode_modulesexpresslib
outerlayer.js:95:5)
at next (ProjectPathfunctions
ode_modulesexpresslib
outer
oute.js:137:13)
at Route.dispatch (ProjectPathfunctions
ode_modulesexpresslib
outer
oute.js:112:3)
at Layer.handle [as handle_request] (ProjectPathfunctions
ode_modulesexpresslib
outerlayer.js:95:5)
at ProjectPathfunctions
ode_modulesexpresslib
outerindex.js:281:22
at param (ProjectPathfunctions
ode_modulesexpresslib
outerindex.js:354:14)
at param (ProjectPathfunctions
ode_modulesexpresslib
outerindex.js:365:14)
at Function.process_params (ProjectPathfunctions
ode_modulesexpresslib
outerindex.js:410:3)
at next (ProjectPathfunctions
ode_modulesexpresslib
outerindex.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"

},“私人”:是的

你能帮助我吗?我究竟做错了什么?请。

答案

.mergeMap不再是来自rxjs 6的Observable的函数。

你需要使用.pipe,并像这样导入mergeMap

import { mergeMap } from 'rxjs/operators';

// ...

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

以上是关于TypeError:readFile $(...).mergeMap不是firebase服务函数中的函数的主要内容,如果未能解决你的问题,请参考以下文章

Createfile2、ReadFile 和 WriteFile;为啥 ReadFile 不读取我在 WriteFile 中写的内容?

appendFile() 在 readFile() 之前运行,即使 appendFile() 按时间顺序在 readFile() 之后

封装promise版本的readFile

串口:ReadFile 和 CloseHandle [重复]

readFile 是不是缓存内容?

从 fs.readFile 获取数据