我正在Google Cloud上部署我的代码。测试时一切正常,但是当我跑步时:
gcloud app deploy
显示错误。基本上,我需要安装Node.js画布,这需要我已经在我的应用程序上安装的一些依赖项,但它仍然返回错误。以下是日志:
Step #1: > typechecker@2.0.8 preinstall /app/node_modules/extract-opts/node_modules/typechecker
Step #1: > node ./cyclic.js
Step #1:
Step #1:
Step #1: > typechecker@2.0.8 preinstall /app/node_modules/extendr/node_modules/typechecker
Step #1: > node ./cyclic.js
Step #1:
Step #1:
Step #1: > canvas@1.6.10 install /app/node_modules/canvas
Step #1: > node-gyp rebuild
Step #1:
Step #1: ./util/has_lib.sh: 31: ./util/has_lib.sh: pkg-config: not found
Step #1: gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
Step #1: gyp ERR! configure error
Step #1: gyp ERR! stack Error: `gyp` failed with exit code: 1
Step #1: gyp ERR! stack at ChildProcess.onCpExit (/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
Step #1: gyp ERR! stack at emitTwo (events.js:126:13)
Step #1: gyp ERR! stack at ChildProcess.emit (events.js:214:7)
Step #1: gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
Step #1: gyp ERR! System Linux 4.4.0-116-generic
Step #1: gyp ERR! command "/nodejs/bin/node" "/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
Step #1: gyp ERR! cwd /app/node_modules/canvas
Step #1: gyp ERR! node -v v8.10.0
Step #1: gyp ERR! node-gyp -v v3.6.2
Step #1: gyp ERR! not ok
Step #1: npm WARN package.json@1.0.0 No repository field.
Step #1: npm WARN The package reactstrap is included as both a dev and production dependency.
Step #1: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
Step #1: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
Step #1:
Step #1: npm ERR! code ELIFECYCLE
Step #1: npm ERR! errno 1
Step #1: npm ERR! canvas@1.6.10 install: `node-gyp rebuild`
Step #1: npm ERR! Exit status 1
Step #1: npm ERR!
Step #1: npm ERR! Failed at the canvas@1.6.10 install script.
Step #1: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Step #1:
Step #1: npm ERR! A complete log of this run can be found in:
Step #1: npm ERR! /root/.npm/_logs/2018-03-26T04_20_15_774Z-debug.log
Step #1: The command '/bin/sh -c npm install --unsafe-perm || ((if [ -f npm-debug.log ]; then cat npm-debug.log; fi) && false)' returned a non-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/cloud_builders/docker@sha256:88d8c498fe61a305c35270036827752eaa7d3cc907c6092ed529d870131de440" failed: exit status 1
Step #1:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/gcr/builds/90bde4a5-cf43-4bd1-95a4-bac00edfa6e1?project=samparq-198005 Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
答案 0 :(得分:0)
问题记录在案here。我要粘贴answer given:
显然我们缺少cairo模块 画布包需要(https://www.cairographics.org/),因此 安装失败。我们正在研究如何包含该模块 在基本图像中,我找到了canvas预制包 (https://www.npmjs.com/package/canvas-prebuilt)没有 安装问题。这对你有用吗?
在我的情况下它已经有效,所以我认为它是有效的。希望它也适合你。