我对这个谷歌云平台的解决方案很感兴趣,但我面临着一个问题。https://cloud.google.com/solutions/processing-user-generated-content-using-video-intelligence
我试图在这个Github repo上制造一个问题,但没有问题标签。所以,我在这里发布了我的问题。https://github.com/GoogleCloudPlatform/cloud-functions-intelligentcontent-nodejs
我在GCP的云外壳上做了所有的事情。
我遵循了教程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
你能给我什么建议吗?
这可能很难。我不能够遵循整个程序,但我希望它会有所帮助。
Clould函数在部署期间正在运行npm install
。因此,在克隆github repo之后,我用这个命令在本地(确切地说是GCP云外壳(复制了这个错误。根据我的理解,这与依赖"@google-cloud/video-intelligence": "^0.3.0"
有关。
当我查看了video-intelligence API文档并尝试在没有版本的情况下使用npm安装它时,它被添加到了"^3.0.1"
版本的项目中。我不确定github是否包含拼写错误或什么,但当我将此依赖项更正为:
"@google-cloud/video-intelligence": "^3.0.1"
npm install
命令运行时没有任何问题。
这应该有助于解决这个特殊的错误,但我不知道它会对整个过程产生什么影响。不管怎样,我希望它会有所帮助!祝你好运