【发布时间】:2018-01-16 07:13:48
【问题描述】:
我正在使用 Angular 5 开发一个 Web 应用程序。使用 ng serve 它可以完美地呈现在我的 localhost:4200 中。当我运行ng serve --prod 时,我的浏览器什么都不加载并抛出这个错误:
ERROR TypeError: Cannot read property 'OVERWRITE' of undefined
at new e (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1149086)
at e.applyServerOverwrite (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:129317)
at e.updateInfo_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1171422)
at new e (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1169637)
at e.createRepo (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1533)
at e.databaseFromApp (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:975)
at Object.t.INTERNAL.registerService.Reference [as database] (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1209912)
at e._getService (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:641580)
at e.s.(anonymous function) [as database] (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:643503)
at new e (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:664222)
Oe @ main.03f1154228018f30c0ac.bundle.js:1
e.handleError @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.runOutsideAngular @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvoke @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
(anonymous) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvokeTask @ main.03f1154228018f30c0ac.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.runTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
v @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
Promise resolved (async)
d @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onScheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleMicroTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
P @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.then @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.appInitializer @ main.03f1154228018f30c0ac.bundle.js:1
e.runInitializers @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvoke @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.run @ main.03f1154228018f30c0ac.bundle.js:1
e.bootstrapModuleFactory @ main.03f1154228018f30c0ac.bundle.js:1
cDNt @ main.03f1154228018f30c0ac.bundle.js:1
o @ inline.e029292f71a17d803f23.bundle.js:1
0 @ main.03f1154228018f30c0ac.bundle.js:1
o @ inline.e029292f71a17d803f23.bundle.js:1
window.webpackJsonp @ inline.e029292f71a17d803f23.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
main.03f1154228018f30c0ac.bundle.js:1 TypeError: Cannot read property 'OVERWRITE' of undefined
at new e (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1149086)
at e.applyServerOverwrite (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:129317)
at e.updateInfo_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1171422)
at new e (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1169637)
at e.createRepo (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1533)
at e.databaseFromApp (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:975)
at Object.t.INTERNAL.registerService.Reference [as database] (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1209912)
at e._getService (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:641580)
at e.s.(anonymous function) [as database] (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:643503)
at new e (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:664222)
main.03f1154228018f30c0ac.bundle.js:1 ERROR TypeError: Cannot read property 'OVERWRITE' of undefined
at new e (main.03f1154228018f30c0ac.bundle.js:1)
at e.applyServerOverwrite (main.03f1154228018f30c0ac.bundle.js:1)
at e.updateInfo_ (main.03f1154228018f30c0ac.bundle.js:1)
at main.03f1154228018f30c0ac.bundle.js:1
at main.03f1154228018f30c0ac.bundle.js:1
at Object.t.forEach (main.03f1154228018f30c0ac.bundle.js:1)
at Object.F1yO.t.each (main.03f1154228018f30c0ac.bundle.js:1)
at e.onServerInfoUpdate_ (main.03f1154228018f30c0ac.bundle.js:1)
at t.handleTimestamp_ (main.03f1154228018f30c0ac.bundle.js:1)
at t.onReady_ (main.03f1154228018f30c0ac.bundle.js:1)
Oe @ main.03f1154228018f30c0ac.bundle.js:1
e.handleError @ main.03f1154228018f30c0ac.bundle.js:1
next @ main.03f1154228018f30c0ac.bundle.js:1
t.object.i @ main.03f1154228018f30c0ac.bundle.js:1
t.__tryOrUnsub @ main.03f1154228018f30c0ac.bundle.js:1
t.next @ main.03f1154228018f30c0ac.bundle.js:1
t._next @ main.03f1154228018f30c0ac.bundle.js:1
t.next @ main.03f1154228018f30c0ac.bundle.js:1
t.next @ main.03f1154228018f30c0ac.bundle.js:1
t.emit @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.runOutsideAngular @ main.03f1154228018f30c0ac.bundle.js:1
onHandleError @ main.03f1154228018f30c0ac.bundle.js:1
e.handleError @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.runTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
_ @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
k @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
main.03f1154228018f30c0ac.bundle.js:1 ERROR TypeError: Cannot read property 'OVERWRITE' of undefined
at new e (main.03f1154228018f30c0ac.bundle.js:1)
at e.applyServerOverwrite (main.03f1154228018f30c0ac.bundle.js:1)
at e.updateInfo_ (main.03f1154228018f30c0ac.bundle.js:1)
at e.onConnectStatus_ (main.03f1154228018f30c0ac.bundle.js:1)
at t.onRealtimeDisconnect_ (main.03f1154228018f30c0ac.bundle.js:1)
at e.close (main.03f1154228018f30c0ac.bundle.js:1)
at main.03f1154228018f30c0ac.bundle.js:1
at e.invokeTask (polyfills.a77f1d02ca80765f17f1.bundle.js:1)
at Object.onInvokeTask (main.03f1154228018f30c0ac.bundle.js:1)
at e.invokeTask (polyfills.a77f1d02ca80765f17f1.bundle.js:1)
Oe @ main.03f1154228018f30c0ac.bundle.js:1
e.handleError @ main.03f1154228018f30c0ac.bundle.js:1
next @ main.03f1154228018f30c0ac.bundle.js:1
t.object.i @ main.03f1154228018f30c0ac.bundle.js:1
t.__tryOrUnsub @ main.03f1154228018f30c0ac.bundle.js:1
t.next @ main.03f1154228018f30c0ac.bundle.js:1
t._next @ main.03f1154228018f30c0ac.bundle.js:1
t.next @ main.03f1154228018f30c0ac.bundle.js:1
t.next @ main.03f1154228018f30c0ac.bundle.js:1
t.emit @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.runOutsideAngular @ main.03f1154228018f30c0ac.bundle.js:1
onHandleError @ main.03f1154228018f30c0ac.bundle.js:1
e.handleError @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.runTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
n.args.(anonymous function) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
setTimeout (async)
c @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onScheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleMacroTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
d @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
(anonymous) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
i.(anonymous function) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
F1yO.t.setTimeoutNonBlocking @ main.03f1154228018f30c0ac.bundle.js:1
e.start_ @ main.03f1154228018f30c0ac.bundle.js:1
e @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
i.g @ main.03f1154228018f30c0ac.bundle.js:1
Ze @ main.03f1154228018f30c0ac.bundle.js:1
Ye @ main.03f1154228018f30c0ac.bundle.js:1
TL6u.e.Qb @ main.03f1154228018f30c0ac.bundle.js:1
ke @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvoke @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
(anonymous) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvokeTask @ main.03f1154228018f30c0ac.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.runTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
v @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
n.args.(anonymous function) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
setTimeout (async)
c @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onScheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleMacroTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
d @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
(anonymous) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
i.(anonymous function) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleConnect_ @ main.03f1154228018f30c0ac.bundle.js:1
t.onOnline_ @ main.03f1154228018f30c0ac.bundle.js:1
e.on @ main.03f1154228018f30c0ac.bundle.js:1
t @ main.03f1154228018f30c0ac.bundle.js:1
e @ main.03f1154228018f30c0ac.bundle.js:1
e.createRepo @ main.03f1154228018f30c0ac.bundle.js:1
e.databaseFromApp @ main.03f1154228018f30c0ac.bundle.js:1
t.INTERNAL.registerService.Reference @ main.03f1154228018f30c0ac.bundle.js:1
e._getService @ main.03f1154228018f30c0ac.bundle.js:1
s.(anonymous function) @ main.03f1154228018f30c0ac.bundle.js:1
e @ main.03f1154228018f30c0ac.bundle.js:1
se @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
xi @ main.03f1154228018f30c0ac.bundle.js:1
Ii @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
xi @ main.03f1154228018f30c0ac.bundle.js:1
Ii @ main.03f1154228018f30c0ac.bundle.js:1
e.get @ main.03f1154228018f30c0ac.bundle.js:1
po @ main.03f1154228018f30c0ac.bundle.js:1
co @ main.03f1154228018f30c0ac.bundle.js:1
so @ main.03f1154228018f30c0ac.bundle.js:1
Uo @ main.03f1154228018f30c0ac.bundle.js:1
Lo @ main.03f1154228018f30c0ac.bundle.js:1
na @ main.03f1154228018f30c0ac.bundle.js:1
t.create @ main.03f1154228018f30c0ac.bundle.js:1
t.create @ main.03f1154228018f30c0ac.bundle.js:1
e.bootstrap @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e._moduleDoBootstrap @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvoke @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
(anonymous) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvokeTask @ main.03f1154228018f30c0ac.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.runTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
v @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
Promise resolved (async)
d @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onScheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleMicroTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
P @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.then @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.appInitializer @ main.03f1154228018f30c0ac.bundle.js:1
e.runInitializers @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
onInvoke @ main.03f1154228018f30c0ac.bundle.js:1
e.invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.run @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.run @ main.03f1154228018f30c0ac.bundle.js:1
e.bootstrapModuleFactory @ main.03f1154228018f30c0ac.bundle.js:1
cDNt @ main.03f1154228018f30c0ac.bundle.js:1
o @ inline.e029292f71a17d803f23.bundle.js:1
0 @ main.03f1154228018f30c0ac.bundle.js:1
o @ inline.e029292f71a17d803f23.bundle.js:1
window.webpackJsonp @ inline.e029292f71a17d803f23.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
main.03f1154228018f30c0ac.bundle.js:1 FIREBASE WARNING: Exception was thrown by user callback. TypeError: Cannot read property 'myID' of undefined
at http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1186752
at e.newRequest_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1186856)
at e.startLongPoll (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1186493)
at e.start (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1182574)
at e.onHandshake_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1077185)
at e.onControl_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1076527)
at e.onPrimaryMessageReceived_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1076067)
at e.onMessage_ (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1074274)
at http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:1063122
at Object.F1yO.t.exceptionGuard (http://localhost:4200/main.03f1154228018f30c0ac.bundle.js:1:120625)
F1yO.t.warn @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
e.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.runTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.invokeTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
invoke @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
n.args.(anonymous function) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
setTimeout (async)
c @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
e.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
t.scheduleMacroTask @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
d @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
(anonymous) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
i.(anonymous function) @ polyfills.a77f1d02ca80765f17f1.bundle.js:1
F1yO.t.exceptionGuard @ main.03f1154228018f30c0ac.bundle.js:1
t @ main.03f1154228018f30c0ac.bundle.js:1
i @ main.03f1154228018f30c0ac.bundle.js:1
e.handleResponse @ main.03f1154228018f30c0ac.bundle.js:1
(anonymous) @ main.03f1154228018f30c0ac.bundle.js:1
pRTLPCB @ .lp?start=t&ser=53021794&cb=1&v=5&ns=strongholdings-40ee8:6
(anonymous) @ .lp?start=t&ser=53021794&cb=1&v=5&ns=strongholdings-40ee8:9
polyfills.a77f1d02ca80765f17f1.bundle.js:1 Uncaught TypeError: Cannot read property 'myID' of undefined
at main.03f1154228018f30c0ac.bundle.js:1
at e.newRequest_ (main.03f1154228018f30c0ac.bundle.js:1)
at e.startLongPoll (main.03f1154228018f30c0ac.bundle.js:1)
at e.start (main.03f1154228018f30c0ac.bundle.js:1)
at e.onHandshake_ (main.03f1154228018f30c0ac.bundle.js:1)
at e.onControl_ (main.03f1154228018f30c0ac.bundle.js:1)
at e.onPrimaryMessageReceived_ (main.03f1154228018f30c0ac.bundle.js:1)
at e.onMessage_ (main.03f1154228018f30c0ac.bundle.js:1)
at main.03f1154228018f30c0ac.bundle.js:1
at Object.F1yO.t.exceptionGuard (main.03f1154228018f30c0ac.bundle.js:1)
使用ng serve --aot 项目再次完美呈现。我想部署所以我做了一个ng build --aot 并且正确地部署到了firebase并且它工作正常。为什么ng serve --prod 会出现此错误,继续部署--aot 版本是否安全?当我执行ng build --prod 时,Angular CLI 也不会抛出错误
有什么帮助吗?
【问题讨论】:
-
它是安全的,但你会失去性能。但是,如果没有实际代码,我们无法真正帮助您。
-
这个对象
OVERWRITE指向哪里。能否请您添加相关代码 -
这就是我困惑的地方,我从未使用过这个对象
OVERWRITE。我假设它在生产构建期间被注入到某个地方
标签: angular angular-cli firebase-hosting