Google Cloud无法正确安装软件包

时间:2019-03-10 12:23:12

标签: google-app-engine google-cloud-platform

我正在尝试将我的应用程序部署到Google Clouds App Engine。它可以完美地用作本地实例,但是一旦我将其上传到gcloud,它就会按预期停止工作。

我正在为不和谐创建一个机器人。通过它,我访问discord和youtubes API。连接到这些似乎可行,因为该机器人在发布后就可以联机了。但是,似乎音乐播放功能在gcloud上运行时会停止运行。所有其他功能均按预期工作。这就是为什么我怀疑某些软件包出了问题的原因。可能与音乐或声音有关。

问题:是否可以通过云Console或cmd验证我的节点软件包是否已正确安装?或者更好的是,重新安装它们。

我看过Deploy and run App Engine

我使用cmd工具发布并运行:gcloud app deploy

app.yaml:

runtime: nodejs
env: flex
manual_scaling:
  instances: 1

package.json:

{
  "name": "yup",
  "version": "1.0.5",
  "description": "bot",
  "main": "app.js",
  "private": true,
  "engines": {
    "node": ">=8.11.3"
  },
  "scripts": {
    "start": "node app.js",
    "deploy": "gcloud app deploy",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Joel",
  "license": "ISC",
  "dependencies": {
    "@types/request": "^2.48.1",
    "discord.js": "^11.4.2",
    "express": "^4.16.4",
    "ffmpeg-binaries": "^4.0.0",
    "fs": "0.0.1-security",
    "get-youtube-id": "^1.0.1",
    "opusscript": "0.0.6",
    "request": "^2.88.0",
    "youtube-info": "^1.3.2",
    "ytdl-core": "^0.29.1",
    "ytdl-getinfo": "^1.1.0"
  },
  "devDependencies": {
    "typescript": "^3.3.3333"
  }
}

进一步检查后,我可以在安装日志中看到这一点:

Step #1: npm WARN discord.js@11.4.2 requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
Step #1: npm WARN discord.js@11.4.2 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
Step #1: npm WARN discord.js@11.4.2 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
Step #1: npm WARN discord.js@11.4.2 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
Step #1: npm WARN discord.js@11.4.2 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
Step #1: npm WARN discord.js@11.4.2 requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.

1 个答案:

答案 0 :(得分:0)

要检查是否已从Google Cloud Console正确安装了App Engine应用程序的依存关系,

  1. 在Stackdriver Logging>日志(日志查看器)页面上检查日志。
  2. Filter logs
    • 按资源,从下拉菜单中选择: 云构建,
    • 通过文本搜索来搜索package.json或指定 包,例如ffmpeg-binaries
    • 按日期,

还可以从Cloud Shell环境获取App Engine构建日志:

  1. 获取内部版本号:$ cloud builds list
  2. List complete build log$ gcloud builds log [build-ID]

在日志中,您应该看到:successfully installed [package name-version]

要重新安装依赖项,您需要部署新版本的应用程序。如果已经缓存的程序包出现问题,请尝试--no-cache标志mentioned in the documentation