尝试将Node.js项目部署到Google应用引擎时出错

时间:2021-08-03 14:04:43

I am trying to deploy my node.js project to my App Engine project. the command I use is gcloud preview app deploy app.yaml.

我正在尝试将我的node.js项目部署到我的App Engine项目。我使用的命令是gcloud预览应用程序部署app.yaml。

This is my app.yaml file:

这是我的app.yaml文件:

runtime: nodejs
vm: true
skip_files:
  - ^(.*/)?.*/node_modules/.*$

and this is the error I get: ERROR: (gcloud.preview.app.deploy) We were unable to detect the runtime to use for this application. Please specify the [runtime] field in your application yaml file or check that your application is configured correctly.

这是我得到的错误:错误:(gcloud.preview.app.deploy)我们无法检测到用于此应用程序的运行时。请在应用程序yaml文件中指定[runtime]字段,或检查您的应用程序是否配置正确。

I'm pretty sure I have set up the project correctly, and have also gcloud init my gcloud CLI.

我很确定我已经正确设置了项目,还有gcloud init我的gcloud CLI。

Any help'd be appreciated!

任何帮助都将不胜感激!

EDIT:

编辑:

$ gcloud --version
Google Cloud SDK 99.0.0

bq 2.0.18
bq-nix 2.0.18
core 2016.02.26
core-nix 2016.02.05
gcloud 
gsutil 4.17
gsutil-nix 4.15

$ gcloud components list

Your current Cloud SDK version is: 99.0.0
The latest available version is: 99.0.0

┌─────────────────────────────────────────────────────────────────────────────────┐
│                                    Components                                   │
├───────────────┬─────────────────────────────────┬───────────────────┬───────────┤
│     Status    │               Name              │         ID        │    Size   │
├───────────────┼─────────────────────────────────┼───────────────────┼───────────┤
│ Not Installed │ Cloud Datastore Emulator        │ gcd-emulator      │  38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator          │ pubsub-emulator   │  10.1 MiB │
│ Not Installed │ gcloud Alpha Commands           │ alpha             │   < 1 MiB │
│ Not Installed │ gcloud Beta Commands            │ beta              │   < 1 MiB │
│ Not Installed │ gcloud app Java Extensions      │ app-engine-java   │ 101.4 MiB │
│ Not Installed │ gcloud app Python Extensions    │ app-engine-python │   7.2 MiB │
│ Not Installed │ kubectl                         │ kubectl           │   5.2 MiB │
│ Installed     │ BigQuery Command Line Tool      │ bq                │   < 1 MiB │
│ Installed     │ Cloud SDK Core Libraries        │ core              │   3.9 MiB │
│ Installed     │ Cloud Storage Command Line Tool │ gsutil            │   2.6 MiB │
│ Installed     │ Default set of gcloud commands  │ gcloud            │           │
└───────────────┴─────────────────────────────────┴───────────────────┴───────────┘

1 个解决方案

#1


5  

Try adding --verbosity=debug to your "gcloud preview app deploy" command to see what's going on. Most likely, there's something else about your application that gcloud doesn't recognize, like a missing or invalid package.json. This is being badly reported as an unrecognized runtime.

尝试将--verbosity = debug添加到“gcloud preview app deploy”命令中,看看发生了什么。最有可能的是,gcloud无法识别您的应用程序的其他内容,例如缺少或无效的package.json。这被严重报告为无法识别的运行时。

To be recognized as a node.js app, you must either have a server.js file or have a package.json file with a "scripts" section specifying a "start" command.

要被识别为node.js应用程序,您必须具有server.js文件或具有指定“start”命令的“scripts”部分的package.json文件。

#1


5  

Try adding --verbosity=debug to your "gcloud preview app deploy" command to see what's going on. Most likely, there's something else about your application that gcloud doesn't recognize, like a missing or invalid package.json. This is being badly reported as an unrecognized runtime.

尝试将--verbosity = debug添加到“gcloud preview app deploy”命令中,看看发生了什么。最有可能的是,gcloud无法识别您的应用程序的其他内容,例如缺少或无效的package.json。这被严重报告为无法识别的运行时。

To be recognized as a node.js app, you must either have a server.js file or have a package.json file with a "scripts" section specifying a "start" command.

要被识别为node.js应用程序,您必须具有server.js文件或具有指定“start”命令的“scripts”部分的package.json文件。