首页 > 解决方案 > Google App Engine 标准环境中的“纱线:未找到”

问题描述

我正在将现有的 GAE Flex 应用程序迁移到 GAE 标准,但该应用程序无法启动。该gcloud app deploy命令成功,但网络服务器进程在调用以下命令时失败yarn

[start] 2021/04/23 16:40:57.592718 No entrypoint specified, using default entrypoint: /serve
[start] 2021/04/23 16:40:57.596207 Starting app
[start] 2021/04/23 16:40:57.596522 Executing: /bin/sh -c exec /serve
[start] 2021/04/23 16:40:57.602799 Waiting for network connection open. Subject:"app/invalid" Address:127.0.0.1:8080
[start] 2021/04/23 16:40:57.603189 Waiting for network connection open. Subject:"app/valid" Address:127.0.0.1:8081
[serve] 2021/04/23 16:40:57.616964 Serve started.
[serve] 2021/04/23 16:40:57.617857 Args: {runtimeLanguage:nodejs runtimeName:nodejs14 memoryMB:256 positional:[]}
[serve] 2021/04/23 16:40:57.620632 Running /bin/sh -c DEBUG=express:*,typeorm:* yarn ts-node:run src/index.ts
sh: 1: yarn: not found
[start] 2021/04/23 16:40:57.628730 Start program failed: failed to detect app after start: ForAppStart(): [aborted, context canceled. subject:"app/valid" Timeout:30m0s, attempts:4 aborted, context canceled. subject:"app/invalid" Timeout:30m0s, attempts:5]
Container called exit(1). 

似乎它yarn在构建步骤中被拾取并且工作得很好,但在运行时却没有。Cloudbuild 日志包含一堆与此类似的行:

Step #7 - "exporter": Reusing layer 'google.nodejs.yarn:env' 

app.yaml 是最小的:

runtime: nodejs14
service: /* redacted */

resources:
  cpu: 2
  memory_gb: 2

includes:
  - env_variables.production.yaml

#[START cloudsql_settings]
beta_settings:
  cloud_sql_instances: /* redacted */
#[END cloudsql_settings]

package.json看起来大致是这样的:

{
  "engines": {
    "node": ">=14"
  },
  ...,
  "scripts": {
    "start": "DEBUG=express:*,typeorm:* yarn ts-node:run src/index.ts",
    "ts-node:run": "ts-node -r tsconfig-paths/register -r dotenv/config"
  }
}

我在这里有什么可能的解决方法?我想避免切换到,npm因为一堆包脚本yarn已经依赖,并且需要时间来确保更改不会影响它们。

在 GCP github 中搜索解决方案时,我在 ruby​​-docker 映像中遇到了类似的问题。这很可能是 GCP 方面的一个临时错误。

标签: google-app-engineapp.yamlgoogle-appengine-node

解决方案


推荐阅读