Heroku 构建依赖项安装失败 [英] Heroku build failing on dependency install
问题描述
Node Canvas 没有安装在 Heroku 版本上,尽管它在我自己的 PC 上运行良好.我在 nodejs 版本 12.16.3 上.我在任何地方都找不到解决方案.
Node Canvas isn't installing on Heroku build, even though it works just fine on my own PC. I'm on nodejs version 12.16.3. I can't find a solution for this anywhere.
Canvas 是必须的,在 Heroku 之前我从未见过这个错误.这是 Heroku 的问题还是我的包/包锁定文件的问题?
Canvas is a must, and I've never seen this error before until Heroku. Is this a problem with Heroku or a problem with my package/package-lock files?
如果你需要的话,我的 Discord 是 Tom Becker#0590.
My Discord is Tom Becker#0590 in case you need it.
这是我的构建日志:
-----> 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
推荐答案
看起来预构建的包有一些问题.它可以根据 Node.js 版本工作,对我有用的最新版本是 14.14.0
所以尝试在你的 package.json
Looks like there is some issue with prebuilt packages. It can work depending on Node.js version, latest version which is worked for me is 14.14.0
so try to setup it in your package.json
- v12.0.x 成功
- v12.16.x 失败
- v12.x.x 失败
- v13.0.x 成功
- v13.3.0 成功
- v13.x.x 失败
- v14.0.x 失败
- v14.1.x 失败
- v14.14.0 成功
- v15.0.1 失败
在此处了解更多信息 https://github.com/Automattic/node-canvas/issues/1563#issuecomment-625149050
在最近发布后我的构建从 Node v14.14.0 切换到 v15.0.1 后,我遇到了类似的问题 https://nodejs.org/en/blog/release/v15.0.1/
I had similar issue after my builds switched from Node v14.14.0 to v15.0.1 after recent release https://nodejs.org/en/blog/release/v15.0.1/
这篇关于Heroku 构建依赖项安装失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!