google-app-engine - 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 方面的一个临时错误。
解决方案
推荐阅读
- android - android - 从用户的图库中保存图片
- vue.js - 在 Vue 页面中嵌入 mapbox-gl 对象?
- python - 想要在 PDF 文档中保存多个绘图
- java - Mapstructs 在 MapperImpl 中生成错误代码
- python - 如何在python中使用和号对数学表达式进行排序
- objective-c - NSString 到 const void *
- python - 使用正则表达式仅打印字符串中的字母
- angular - Angular-Protractor-Headless Chromium:使用 APP_INITIALIZE 时,在页面上找不到 Angular
- c# - 在c#中抛出404去customerror.aspx没有302和301
- react-native - 如何在手机上下载资产并在 React Native 应用程序中使用它