找不到'virtual:world'所需的软件包'cairo'

时间:2019-01-30 01:59:54

标签: node.js alpine

我在容器中使用了Alpine Linux。前一段时间,我遇到了与Package cairo was not found in the pkg-config search path. Node j.s install canvas issue相同的错误,我在Dockerfile中添加了以下代码段:

<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>

这使错误消失了(至少根据我的记忆,已经几个月了。)

今天,运行 # Install cairo for one of our frontend dependencies RUN apk add --update --no-cache cairo \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 时再次弹出此错误。这是错误的完整输出:

docker-compose exec web yarn watch

我可以证明开罗在集装箱上

[4/4] Building fresh packages...
success Installed "node-gyp@3.8.0" with binaries:
[1/2] ⠠ canvas
warning Error running install script for optional dependency: "/var/www/html/node_modules/canvas: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /var/www/html/node_modules/canvas
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@8.14.0 | linux | x64
gyp http GET https://nodejs.org/download/release/v8.14.0/node-v8.14.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v8.14.0/node-v8.14.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v8.14.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v8.14.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/share/.config/yarn/global/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/var/www/html/node_modules/canvas/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/share/.config/yarn/global/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/8.14.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/8.14.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/share/.config/yarn/global/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/8.14.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/var/www/html/node_modules/canvas',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
Package 'cairo', required by 'virtual:world', not found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 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 (/usr/local/share/.config/yarn/global/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.9.125-linuxkit
gyp ERR! command \"/usr/bin/node\" \"/usr/local/bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /var/www/html/node_modules/canvas
gyp ERR! node -v v8.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok"
Done in 98.27s.

浏览后我在任何地方都看不到任何WARNING: Ignoring APKINDEX.adfa7ceb.tar.gz: No such file or directory WARNING: Ignoring APKINDEX.efaa1f73.tar.gz: No such file or directory cairo-1.14.12-r2 description: A vector graphics library cairo-1.14.12-r2 webpage: http://cairographics.org/ cairo-1.14.12-r2 installed size: 1097728 cairo-1.14.12-r2 depends on: so:libX11.so.6 so:libXext.so.6 so:libXrender.so.1 so:libc.musl-x86_64.so.1 so:libfontconfig.so.1 so:libfreetype.so.6 so:libpixman-1.so.0 so:libpng16.so.16 so:libxcb-render.so.0 so:libxcb-shm.so.0 so:libxcb.so.1 so:libz.so.1 cairo-1.14.12-r2 provides: so:libcairo-script-interpreter.so.2=2.11400.12 so:libcairo.so.2=2.11400.12 cairo-1.14.12-r2 is required by: cairo-1.14.12-r2 contains: usr/lib/libcairo.so.2.11400.12 usr/lib/libcairo-script-interpreter.so.2 usr/lib/libcairo-script-interpreter.so.2.11400.12 usr/lib/libcairo.so.2 usr/lib/cairo/cairo-sphinx.so.0 usr/lib/cairo/cairo-fdr.so.0 usr/lib/cairo/cairo-fdr.so usr/lib/cairo/cairo-fdr.so.0.0.0 usr/lib/cairo/cairo-sphinx.so usr/lib/cairo/cairo-sphinx.so.0.0.0 cairo-1.14.12-r2 triggers: cairo-1.14.12-r2 has auto-install rule: cairo-1.14.12-r2 affects auto-installation of: cairo-1.14.12-r2 replaces: cairo-1.14.12-r2 license: LGPL-2.0-or-later MPL-1.1 文件,那么如何确定需要采取什么步骤来对cairo.pc进行有关开罗位置的教育?

1 个答案:

答案 0 :(得分:2)

通过安装cairo-dev软件包可以很容易地解决此问题。

根据Alpine的软件包搜索,它将在cairo.pc下安装/usr/lib/pkgconfig,很可能被gyp检测到:

https://pkgs.alpinelinux.org/contents?file=cairo.pc&path=&name=&branch=v3.8