我正在部署Angular(8.0.0)项目,并且在访问部署的网站时遇到此类错误。这不是第一次部署项目,而是第一次出现这样的错误,我在网上搜索,但不知道这是什么。我正在使用 Firebase 托管项目。
当我在笔记本电脑上对其进行测试时,没有任何错误/警告。
main-es2015.936cb835ea7348311cbf.js:1 ERROR Error: Uncaught (in promise): TypeError: xp(...).functions is not a function
TypeError: xp(...).functions is not a function
at main-es2015.936cb835ea7348311cbf.js:1
at a.invoke (polyfills-es2015.5728f680576ca47e99fe.js:1)
at t.run (polyfills-es2015.5728f680576ca47e99fe.js:1)
at Gi.runOutsideAngular (main-es2015.936cb835ea7348311cbf.js:1)
at new <anonymous> (main-es2015.936cb835ea7348311cbf.js:1)
at main-es2015.936cb835ea7348311cbf.js:1
at Ir (main-es2015.936cb835ea7348311cbf.js:1)
at Tr (main-es2015.936cb835ea7348311cbf.js:1)
at main-es2015.936cb835ea7348311cbf.js:1
at Ir (main-es2015.936cb835ea7348311cbf.js:1)
at P (polyfills-es2015.5728f680576ca47e99fe.js:1)
at P (polyfills-es2015.5728f680576ca47e99fe.js:1)
at polyfills-es2015.5728f680576ca47e99fe.js:1
at a.invokeTask (polyfills-es2015.5728f680576ca47e99fe.js:1)
at Object.onInvokeTask (main-es2015.936cb835ea7348311cbf.js:1)
at a.invokeTask (polyfills-es2015.5728f680576ca47e99fe.js:1)
at t.runTask (polyfills-es2015.5728f680576ca47e99fe.js:1)
at _ (polyfills-es2015.5728f680576ca47e99fe.js:1)
以前有人遇到过吗?
我有依赖项:
"dependencies": {
"@angular/animations": "~8.0.0",
"@angular/common": "~8.0.0",
"@angular/compiler": "~8.0.0",
"@angular/core": "~8.0.0",
"@angular/fire": "^5.2.1",
"@angular/forms": "~8.0.0",
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"@sendgrid/mail": "^6.4.0",
"firebase": "^6.3.5",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.5.2",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
我没有更改/更新任何现有的依赖项,项目的更改是添加了一个云功能,该功能在使用“ ng serve”进行测试时可以正常工作
答案 0 :(得分:0)
导入功能
import 'firebase/functions'
或者,如果是最新版本,则为:
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import 'firebase-functions';
admin.initializeApp();