即使在我自己的PC上运行正常,Node Canvas仍未安装在Heroku构建中。我正在使用nodejs版本12.16.3。我在任何地方都找不到解决方案。
画布是必须的,在Heroku之前,我从未见过此错误。这是Heroku的问题还是我的软件包/软件包锁定文件的问题?
如果您需要,我的Discord是Tom Becker#0590。
这是我的构建日志:
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): 12.x
engines.npm (package.json): unspecified (use default)
Resolving node version 12.x...
Downloading and installing node 12.18.1...
Using default npm version: 6.14.5
-----> Installing dependencies
Installing node modules (package.json + package-lock)
> deasync@0.1.19 install /tmp/build_282e7f55032649968878bcdef8821199/node_modules/deasync
> node ./build.js
`linux-x64-node-12` exists; testing
Binary is fine; exiting
> canvas@2.6.1 install /tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas
> node-pre-gyp install --fallback-to-build
Package pangocairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `pangocairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pangocairo' found
gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.4.0-1073-aws
gyp ERR! command "/tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/bin/node" "/tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas/build/Release" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas
gyp ERR! node -v v12.18.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/bin/node /tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/tmp/build_282e7f55032649968878bcdef8821199/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.4.0-1073-aws
node-pre-gyp ERR! command "/tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/bin/node" "/tmp/build_282e7f55032649968878bcdef8821199/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas
node-pre-gyp ERR! node -v v12.18.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/bin/node /tmp/build_282e7f55032649968878bcdef8821199/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/tmp/build_282e7f55032649968878bcdef8821199/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@2.6.1 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! /tmp/npmcache.3BVoV/_logs/2020-06-26T16_20_37_894Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
If you're stuck, please submit a ticket so we can help:
https://help.heroku.com/
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
答案 0 :(得分:0)
预建软件包似乎存在一些问题。它可以根据Node.js版本工作,适用于我的最新版本是14.14.0
,因此请尝试在您的package.json
有关此内容的更多信息,https://github.com/Automattic/node-canvas/issues/1563#issuecomment-625149050
在最新版本https://nodejs.org/en/blog/release/v15.0.1/之后,我的构建从Node v14.14.0切换到v15.0.1之后,我遇到了类似的问题