node.js - 在应用程序配置中找不到 URLMap 条目
问题描述
部署时出现以下错误
C:\Code\NodeJS\nodejs-docs-samples\appengine\hello-world\standard (master)
λ gcloud app deploy
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [C:\Code\NodeJS\nodejs-docs-samples\appengine\hello-world\standard\app.yaml]
No URLMap entries found in application configuration
in "C:\Code\NodeJS\nodejs-docs-samples\appengine\hello-world\standard\app.yaml", line 17, column 1
app.yaml 文件内容如下:
# Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# [START app_yaml]
runtime: nodejs8
# [END app_yaml]
~
解决方案
与您的应用程序本身负责将请求 URL 映射到处理程序的灵活环境不同,在标准环境中,这需要在app.yaml
文件中进行配置,以便 GAE 知道这种映射。从Handlers 元素(浏览该部分中的整个表格,标准环境中的新表格):
该
handlers
元素提供了一个 URL 模式列表以及如何处理它们的描述。App Engine 可以通过执行应用程序代码或提供随代码上传的静态文件(例如图像、CSS 或 JavaScript)来处理 URL。模式按照它们在
app.yaml
文件中出现的顺序从上到下进行评估。模式与 URL 匹配的第一个映射是用于处理请求的映射。
您需要做的就是为您的应用程序提供至少一个这样的 URL 处理程序映射。
推荐阅读
- python - 将我的 python 应用程序部署到 heroku 的问题
- android - 重复类 kotlin 类 kotlin 版本 1.3.70
- java - 使用 SoundPool、Timer 和 TimerTask 每分钟播放一个随机声音
- c++ - 如何在 Qt 中将消息从子窗口小部件发送到父窗口?
- python-3.x - 为什么可滚动画布中的按钮不动?(Python3 + tkinter)
- css - 为什么更改单个组件的 css 会影响所有其他组件?
- google-apps-script - Google Script/Sheet 不确定如何从用户个人资料中提取员工信息部分的信息,例如员工 ID 和职位
- python - 由于 Python 2 中的可变长度可选参数 (*args) 而导致的错误
- python - 在 Django REST 框架中公开 MoneyFields?
- log4j2 - 如何在log4j2中将不同的日志级别写入不同的滚动文件