[英]deploying Angular 6 Universal to GCP App Engine
我正在尋找一個使用Angular 6 Universal並成功部署到GCP App Engine的示例項目。 我已經搜索了GitHub,但找不到示例-Universal Starter不包括部署。 另外,我的舊Angular 5 Universal配置不適用於這個新的V6項目。
當前錯誤來自nginx:“ 502錯誤網關”這似乎是導致問題的favicon.ico文件-看起來像是Node.js問題。 我只是在一個純Node.js項目(不是Angular)上進行了處理,並且能夠解決它,但是我在Angular上下文中找不到正確的配置。
server.ts
app.use(favicon('src/favicon.ico'));
angular.json(開始)
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"appname": {
"root": "",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
},
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
}
],
"styles": [
{
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
},
"src/styles.css"
], ...
dispatch.yaml(因為我有多個服務使用同一域)
dispatch:
# Default service serves the typical web resources and all static resources.
- url: "*/favicon.ico"
service: default
問題是無法正確啟動package.json中的Node。 腳本中的這一行解決了該問題...
"scripts": {
...
"start": "node dist/server.js",
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.