Angular 7应用程序在GAE Flex环境中工作,但不在标准版中

问题描述 投票:0回答:1

在我部署了我的角度7应用程序并尝试在浏览器上打开它之后,我得到错误500.检查日志我发现这个:

A  FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 
A   1: node::Abort() [node] 
A   2: 0x74f83c6b2ae [node] 
A   3: v8::Utils::ReportOOMFailure(char const*, bool) [node] 
A   4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node] 
A   5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [node] 
A   6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node] 
A   7: v8::internal::parsing::ParseProgram(v8::internal::ParseInfo*, v8::internal::Isolate*) [node] 
A   8: 0x74f8416f63b [node] 
A   9: v8::internal::Compiler::GetSharedFunctionInfoForScript(v8::internal::Handle<v8::internal::String>, v8::internal::Handle<v8::internal::Object>, int, int, v8::ScriptOriginOptions, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Context>, v8::Extension*, v8::internal::ScriptData**, v8::ScriptCompiler::CompileOptions, v8::internal::NativesFlag) [node] 
A  10: v8::ScriptCompiler::CompileUnboundInternal(v8::Isolate*, v8::ScriptCompiler::Source*, v8::ScriptCompiler::CompileOptions) [node] 
A  11: 0x74f83c9a9fb [node] 
A  12: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node] 
A  13: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node] 
A  14: 0x2ef87fd042fd 
A  Aborted 

事情是,如果你谷歌FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory修复应该改变package.json开始行到这个"start": "node --max_old_space_size=4096 dist/server",。有了这个,日志中的错误消失了,但页面仍然给出错误500,现在日志只显示:

F  GET 500 0 B 3.3 s Chrome 70 / GET 500 0 B 3.3 s Chrome 70 5cb9a64b00ff0dd3429e5e7b0e0001657e6e6f6c696665000166726f6e74656e643a323031393034313974313333353337000100
A  Node Express server listening on http://localhost:8080 

也许我需要在app.yaml文件中写更多内容或更改它,现在它看起来像这样:

runtime: nodejs8
env: standard
service: frontend

我的角度应用程序也是服务器端渲染,不使用firebase。

google-app-engine google-appengine-node
1个回答
0
投票

我搞定了。问题似乎出现在app.yaml文件中。我不得不将instance_class设置为F2。如果你没有设置你是默认F1并且那个类中的内存太低了。现在我的app.yaml文件如下所示:

runtime: nodejs8
env: standard
service: frontend
instance_class: F2
© www.soinside.com 2019 - 2024. All rights reserved.