我有一个 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/