错误:(gcloud.functions.deploy)OperationError:代码= 3,消息=构建失败

时间:2020-08-04 01:31:56

标签: node.js google-cloud-platform google-cloud-functions

我对该Google Cloud Platform的解决方案感兴趣,但遇到了问题。 https://cloud.google.com/solutions/processing-user-generated-content-using-video-intelligence

我试图在这个Github仓库上发布一个问题,但是没有问题标签。所以,我在这里发布我的问题。 https://github.com/GoogleCloudPlatform/cloud-functions-intelligentcontent-nodejs

我在GCP的Cloud Shell上进行了所有操作。

我遵循了教程https://cloud.google.com/solutions/processing-user-generated-content-using-video-intelligence,在我部署GCStoPubsub函数之前,一切都是完美的。

部署GCStoPubsub函数

https://cloud.google.com/solutions/processing-user-generated-content-using-video-intelligence#deploy_the_gcstopubsub_function

首先,我尝试了这个。

gcloud functions deploy GCStoPubsub --stage-bucket gs://staging-kazu --trigger-topic upload_notification --entry-point GCStoPubsub

然后,我收到此错误消息。

ERROR: (gcloud.functions.deploy) Missing required argument [runtime]: Flag `--runtime` is requir
ed for new functions.

因此,我添加了--runtime nodejs10,然后重试。

gcloud functions deploy GCStoPubsub --stage-bucket gs://staging-kazu --trigger-topic upload_notification --entry-point GCStoPubsub --runtime nodejs10

然后,我得到了更大的错误消息。

Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: ...ence/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 5.3.0-1030-gcp
node-pre-gyp ERR! command "/usr/bin/node" "/workspace/node_modules/@google-cloud/video-intelligence/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=s
tatic_library"
node-pre-gyp ERR! cwd /workspace/node_modules/@google-cloud/video-intelligence/node_modules/grpc
node-pre-gyp ERR! node -v v10.20.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
In file included from ../deps/grpc/src/core/lib/channel/channel_stack.c:19:0:
../deps/grpc/src/core/lib/channel/channel_stack.h:38:10: fatal error: grpc/grpc.h: No such file or directory
 #include <grpc/grpc.h>
          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_stack.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:191:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.3.0-1030-gcp
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/workspace/node_modules/@goo
gle-cloud/video-intelligence/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/workspace/node_modules/@google-cloud/v
ideo-intelligence/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc"
gyp ERR! cwd /workspace/node_modules/@google-cloud/video-intelligence/node_modules/grpc
gyp ERR! node -v v10.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN The package ava is included as both a dev and production dependency.
npm WARN The package sinon is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.7.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.7.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /builder/home/.npm/_logs/2020-08-03T08_15_41_930Z-debug.log; Error ID: 49341d49

请给我任何建议吗?

1 个答案:

答案 0 :(得分:1)

这可能很难。我无法遵循整个过程,但希望对您有所帮助。

云功能在部署期间正在运行npm install。因此,在克隆github存储库后,我已使用此命令在本地复制了此错误(精确地是GCP云外壳)。据我了解,这与依赖项"@google-cloud/video-intelligence": "^0.3.0"有关。

当我查看video-intelligence API documentation并尝试使用不带版本的npm安装它时,它已被添加到版本"^3.0.1"的项目中。我不确定github是否包含拼写错误或其他内容,但是当我将此依赖关系更正为:

"@google-cloud/video-intelligence": "^3.0.1"

npm install命令运行没有问题。

这应该有助于解决此特定错误,但是我不知道它将对整个过程产生什么影响。无论如何,我希望它会有所帮助!祝你好运!