GCP App Engine / Angular-加载模块脚本失败:服务器以非JavaScript MIME类型“ text / html”响应]] << [

问题描述 投票:0回答:1
我正在尝试使用App Engine在Google Cloud Platform上托管Angular应用。问题是,在成功部署它之后,我能够访问它大约2-3分钟,点击刷新并没有收到HTTP错误404,但是在那2-3分钟之后,我在Chrome中收到以下错误(同事在他们的计算机上也收到相同的错误):

enter image description here

我尝试使用以下方式构建我的角度应用程序:

ng build --prod ng build --prod --base-href sep6-app

Angular应用程序文件夹结构:

- dist/ - sep6-app/ - app.yaml

我的app.yaml:

runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* static_files: sep6-app/index.html upload: sep6-app/index.html - url: /.* static_dir: sep6-app

在GCP内部,我的存储桶包含:

- app.yaml - sep6-app/

一件事,如果我这样在app.yaml中设置URL,然后重新部署:

- url: / static_files: sep6-app/index.html upload: sep6-app/index.html - url: / static_dir: sep6-app

我能够毫无问题地访问我的应用程序,但是如果我刷新任何页面,都会收到404错误,由于Angular处理路线的方式,我认为这是可以理解的。但是我不明白为什么“-url:/.*”会在短时间内工作然后停止?

我正在使用(如果需要):

Angular CLI: 9.1.7 Angular: 9.1.9

关于为什么会发生这种情况以及如何解决这一问题的任何想法或想法?谢谢!

我正在尝试使用App Engine在Google Cloud Platform上托管Angular应用。问题是,在成功部署它之后,我可以访问它大约2-3分钟,然后单击刷新...

angular google-app-engine google-cloud-platform mime-types app.yaml
1个回答
0
投票
通过使用以下app.yaml使其能够正常工作:
© www.soinside.com 2019 - 2024. All rights reserved.