node.js - app.yaml 与 main.js 位于不同的目录中?

标签 node.js google-app-engine gcloud

我有一个 Node.JS 应用程序想要部署在 AppEngine 上。目前我收到以下错误:

Beginning deployment of service [default]...
Building and pushing image for service [default]
ERROR: node.js checker: Neither "start" in the "scripts" section of "package.json" nor the "server.js" file were found.
ERROR: (gcloud.app.deploy) Your application does not satisfy all of the requirements for a runtime of type [nodejs].  Please correct the errors and try again.

这是有道理的,因为这是文件夹结构:

  • 客户端
  • 服务器
    • main.js
  • app.yaml

如您所见,我有一个单独的文件夹用于存放客户端代码和服务器代码。 如果我将 app.yaml 文件放入服务器文件夹中,则部署可以正常工作,但是当我尝试访问该应用程序时,它无法找到客户端文件,因为它们不是部署的一部分。

是否可以在 app.yaml 中进行配置,或者我是否需要重构我的应用程序?

最佳答案

实际上应用程序引擎需要在根目录中的package.json...并在其中放置启动脚本..如start:node server/main.js

关于node.js - app.yaml 与 main.js 位于不同的目录中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43786161/

相关文章:

node.js - "CouchDB with an external agent"模型的托管建议

javascript - NodeJS Object.subClass()

python - 响应后记录请求已被响应

node.js - 使用 mongoose 插入或更新到 Mongodb 并在更新时修改内部元素

node.js - 您可以将 NodeJS REST API 部署到 Glassfish 吗?

java - 为什么服务器端对 URL 的长度有限制?

java - App Engine/Quercus 数据存储区准备查询错误

kubernetes - 在 Google Kubernetes Engine 中设置服务节点端口范围

python - GAE Python Gcloud - 在生产中运行的命令

gcloud - 如何增加 Gcloud 任务 API 中的最大计划时间?