npm i canvas 报错信息

$ npm i canvas> canvas@1.6.13 install /Users/jayson/Documents/workspace/xuebang/question-bank-front_uat_20181026/node_modules/canvas
> node-gyp rebuildgyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
./util/has_lib.sh: line 31: pkg-config: command 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/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jayson/Documents/workspace/xuebang/question-bank-front_uat_20181026/node_modules/canvas
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas@1.6.13 (node_modules/canvas):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas@1.6.13 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1up to date in 9.553s
复制代码

brew install pkg-config

注意到:pkg-config: command not found这个报错,是说操作系统上少了这个命令。参考Can't install rmagick, pkg-config: command not found这篇文章。(对于macos系统来说),主要是执行一下命令:

brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config && brew link pkg-config
复制代码

详细执行过程记录:

$ brew install pkg-config
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
arangodb                   awscli                     binaryen                   ompl                       scala==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2.sierra.bottle.tar.gz
Already downloaded: /Users/jayson/Library/Caches/Homebrew/downloads/c66b3ea1aa568233b601c4df3026803081d97cc5f1e11f92a1b3c04588e45678--pkg-config-0.29.2.sierra.bottle.tar.gz
==> Pouring pkg-config-0.29.2.sierra.bottle.tar.gz
?  /usr/local/Cellar/pkg-config/0.29.2: 11 files, 627.1KB
复制代码

记得把pkg-config的路径添加到.bash_profile到path中:

export PKG_CONFIG_PATH = /usr/local/Cellar/pkg-config/0.29.2/
export PATH=$PKG_CONFIG_PATH/bin:$PATH
复制代码

再尝试 npm i canvas 报错信息

这次报以下错误:

$ npm i canvas> canvas@1.6.13 install /Users/jayson/Documents/workspace/xuebang/question-bank-front_uat_20181026/node_modules/canvas
> node-gyp rebuildgyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
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
No package 'cairo' 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/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jayson/Documents/workspace/xuebang/question-bank-front_uat_20181026/node_modules/canvas
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas@1.6.13 (node_modules/canvas):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas@1.6.13 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1up to date in 9.059s
复制代码

brew install cairo

参考这篇文章npm install canvas简明指南 注意到:to the PKG_CONFIG_PATH environment variable No package 'cairo' found这个报错,cairo可以通过homebrew安装,详细记录如下:

$ brew install cairo
==> Installing dependencies for cairo: libpng, freetype, fontconfig, gettext, libffi, glib and pixman
==> Installing cairo dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.35.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.6.35.sierra.bottle.tar.gz
?  /usr/local/Cellar/libpng/1.6.35: 26 files, 1.2MB
==> Installing cairo dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.9.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring freetype-2.9.1.sierra.bottle.tar.gz
?  /usr/local/Cellar/freetype/2.9.1: 60 files, 2.6MB
==> Installing cairo dependency: fontconfig
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.13.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring fontconfig-2.13.1.sierra.bottle.tar.gz
==> Regenerating font cache, this may take a while
==> /usr/local/Cellar/fontconfig/2.13.1/bin/fc-cache -frv
?  /usr/local/Cellar/fontconfig/2.13.1: 531 files, 3.3MB
==> Installing cairo dependency: gettext
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.19.8.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gettext-0.19.8.1.sierra.bottle.tar.gz
==> Caveats
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.If you need to have gettext first in your PATH run:echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profileFor compilers to find gettext you may need to set:export LDFLAGS="-L/usr/local/opt/gettext/lib"export CPPFLAGS="-I/usr/local/opt/gettext/include"==> Summary
?  /usr/local/Cellar/gettext/0.19.8.1: 1,934 files, 16.9MB
==> Installing cairo dependency: libffi
==> Downloading https://homebrew.bintray.com/bottles/libffi-3.2.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libffi-3.2.1.sierra.bottle.tar.gz
==> Caveats
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.For compilers to find libffi you may need to set:export LDFLAGS="-L/usr/local/opt/libffi/lib"For pkg-config to find libffi you may need to set:export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"==> Summary
?  /usr/local/Cellar/libffi/3.2.1: 16 files, 297.0KB
==> Installing cairo dependency: glib
==> Downloading https://homebrew.bintray.com/bottles/glib-2.58.1.sierra.bottle.tar.gzcurl: (7) Failed to connect to homebrew.bintray.com port 443: Operation timed out
Error: Failed to download resource "glib"
Download failed: https://homebrew.bintray.com/bottles/glib-2.58.1.sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Installing dependencies for glib: autoconf, automake, docbook, docbook-xsl, gdbm, readline, sqlite, python@2, libxml2, boost, source-highlight, gtk-doc and libtool
==> Installing glib dependency: autoconf
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.sierra.bottle.4.tar.gz
######################################################################## 100.0%
==> Pouring autoconf-2.69.sierra.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:/usr/local/share/emacs/site-lisp/autoconf
==> Summary
?  /usr/local/Cellar/autoconf/2.69: 70 files, 3.0MB
==> Installing glib dependency: automake
==> Downloading https://homebrew.bintray.com/bottles/automake-1.16.1_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring automake-1.16.1_1.sierra.bottle.tar.gz
?  /usr/local/Cellar/automake/1.16.1_1: 131 files, 3.4MB
==> Installing glib dependency: docbook
==> Downloading https://homebrew.bintray.com/bottles/docbook-5.0.sierra.bottle.4.tar.gz
######################################################################## 100.0%
==> Pouring docbook-5.0.sierra.bottle.4.tar.gz
==> xmlcatalog --noout --create /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.2/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.2/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.1.2/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.1.2/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.3/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.3/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.4/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.4/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.5/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/docbook/xml/4.5/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook/5.0/docbook/xml/5.0/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook/5.0/docbook/xml/5.0/catalog.xml /usr/local/etc/xml/catalog
==> Caveats
To use the DocBook package in your XML toolchain,
you need to add the following to your ~/.bashrc:export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
==> Summary
?  /usr/local/Cellar/docbook/5.0: 182 files, 4.6MB
==> Installing glib dependency: docbook-xsl
==> Downloading https://homebrew.bintray.com/bottles/docbook-xsl-1.79.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring docbook-xsl-1.79.1.sierra.bottle.tar.gz
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook-xsl/1.79.1/docbook-xsl/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook-xsl/1.79.1/docbook-xsl/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --del file:///usr/local/Cellar/docbook-xsl/1.79.1/docbook-xsl-ns/catalog.xml /usr/local/etc/xml/catalog
==> xmlcatalog --noout --add nextCatalog  file:///usr/local/Cellar/docbook-xsl/1.79.1/docbook-xsl-ns/catalog.xml /usr/local/etc/xml/catalog
?  /usr/local/Cellar/docbook-xsl/1.79.1: 3,829 files, 89.5MB
==> Installing glib dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.18.1.sierra.bottle.tar.gz
?  /usr/local/Cellar/gdbm/1.18.1: 20 files, 587.0KB
==> Installing glib dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.5.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-7.0.5.sierra.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.For compilers to find readline you may need to set:export LDFLAGS="-L/usr/local/opt/readline/lib"export CPPFLAGS="-I/usr/local/opt/readline/include"==> Summary
?  /usr/local/Cellar/readline/7.0.5: 46 files, 1.5MB
==> Installing glib dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.26.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring sqlite-3.26.0.sierra.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.If you need to have sqlite first in your PATH run:echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profileFor compilers to find sqlite you may need to set:export LDFLAGS="-L/usr/local/opt/sqlite/lib"export CPPFLAGS="-I/usr/local/opt/sqlite/include"For pkg-config to find sqlite you may need to set:export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"==> Summary
?  /usr/local/Cellar/sqlite/3.26.0: 11 files, 3.7MB
==> Installing glib dependency: python@2
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.15_1.sierra.bottle.7.tar.gz
######################################################################## 100.0%
==> Pouring python@2-2.7.15_1.sierra.bottle.7.tar.gz
==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scri
==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scri
==> /usr/local/Cellar/python@2/2.7.15_1/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scri
==> Caveats
Pip and setuptools have been installed. To update thempip install --upgrade pip setuptoolsYou can install Python packages withpip install <package>They will install into the site-package directory/usr/local/lib/python2.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python
==> Summary
?  /usr/local/Cellar/python@2/2.7.15_1: 4,666 files, 82.5MB
==> Installing glib dependency: libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.8.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libxml2-2.9.8.sierra.bottle.tar.gz
==> Caveats
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.If you need to have libxml2 first in your PATH run:echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.bash_profileFor compilers to find libxml2 you may need to set:export LDFLAGS="-L/usr/local/opt/libxml2/lib"export CPPFLAGS="-I/usr/local/opt/libxml2/include"For pkg-config to find libxml2 you may need to set:export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"==> Summary
?  /usr/local/Cellar/libxml2/2.9.8: 281 files, 10.4MB
==> Installing glib dependency: boost
==> Downloading https://homebrew.bintray.com/bottles/boost-1.68.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring boost-1.68.0.sierra.bottle.tar.gz
?  /usr/local/Cellar/boost/1.68.0: 13,712 files, 451.4MB
==> Installing glib dependency: source-highlight
==> Downloading https://homebrew.bintray.com/bottles/source-highlight-3.1.8_10.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring source-highlight-3.1.8_10.sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:/usr/local/etc/bash_completion.d
==> Summary
?  /usr/local/Cellar/source-highlight/3.1.8_10: 422 files, 6MB
==> Installing glib dependency: gtk-doc
==> Downloading https://homebrew.bintray.com/bottles/gtk-doc-1.28.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gtk-doc-1.28.sierra.bottle.tar.gz
?  /usr/local/Cellar/gtk-doc/1.28: 102 files, 2.8MB
==> Installing glib dependency: libtool
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libtool-2.4.6_1.sierra.bottle.tar.gz
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
?  /usr/local/Cellar/libtool/2.4.6_1: 70 files, 3.7MB
==> Downloading https://download.gnome.org/sources/glib/2.58/glib-2.58.1.tar.xz
==> Downloading from https://mirrors.ustc.edu.cn/gnome/sources/glib/2.58/glib-2.58.1.tar.xz
######################################################################## 100.0%
==> Downloading https://raw.githubusercontent.com/Homebrew/formula-patches/59e4d32/glib/hardcoded-paths.diff
######################################################################## 100.0%
==> Downloading https://raw.githubusercontent.com/Homebrew/formula-patches/5857984/glib/revert-appinfo-contenttype.patch
######################################################################## 100.0%
==> Patching
==> Applying hardcoded-paths.diff
patching file gio/gdbusprivate.c
Hunk #1 succeeded at 2098 (offset -1 lines).
Hunk #2 succeeded at 2108 (offset -1 lines).
patching file gio/xdgmime/xdgmime.c
patching file glib/gutils.c
Hunk #1 succeeded at 2043 with fuzz 2 (offset 105 lines).
==> Applying revert-appinfo-contenttype.patch
patching file gio/Makefile.am
Hunk #2 succeeded at 405 (offset 11 lines).
Hunk #3 succeeded at 640 (offset 35 lines).
Hunk #4 succeeded at 923 (offset 37 lines).
Hunk #5 succeeded at 933 (offset 37 lines).
patching file gio/giomodule.c
Hunk #2 succeeded at 1024 (offset 16 lines).
Hunk #3 succeeded at 1165 (offset 16 lines).
patching file gio/glocalfileinfo.c
Hunk #1 succeeded at 1308 (offset 18 lines).
patching file gio/tests/Makefile.am
Hunk #1 succeeded at 353 (offset 6 lines).
==> ./autogen.sh
==> ./configure --disable-maintainer-mode --disable-silent-rules --disable-dtrace --disable-libelf --enable-static --prefix=/usr/local/Cellar/glib/2.58.1 --localstatedir=/usr/l
==> make
==> make install
?  /usr/local/Cellar/glib/2.58.1: 451 files, 18.8MB, built in 2 minutes 52 seconds
==> Installing cairo dependency: pixman
==> Downloading https://homebrew.bintray.com/bottles/pixman-0.34.0_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pixman-0.34.0_1.sierra.bottle.tar.gz
?  /usr/local/Cellar/pixman/0.34.0_1: 13 files, 1.3MB
==> Installing cairo
==> Downloading https://homebrew.bintray.com/bottles/cairo-1.16.0.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cairo-1.16.0.sierra.bottle.tar.gz
?  /usr/local/Cellar/cairo/1.16.0: 117 files, 5.5MB
==> Caveats
==> gettext
gettext is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD gettext library & some software gets confused if both are in the library path.If you need to have gettext first in your PATH run:echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.bash_profileFor compilers to find gettext you may need to set:export LDFLAGS="-L/usr/local/opt/gettext/lib"export CPPFLAGS="-I/usr/local/opt/gettext/include"==> libffi
libffi is keg-only, which means it was not symlinked into /usr/local,
because some formulae require a newer version of libffi.For compilers to find libffi you may need to set:export LDFLAGS="-L/usr/local/opt/libffi/lib"For pkg-config to find libffi you may need to set:export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"==> autoconf
Emacs Lisp files have been installed to:/usr/local/share/emacs/site-lisp/autoconf
==> docbook
To use the DocBook package in your XML toolchain,
you need to add the following to your ~/.bashrc:export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"
==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.For compilers to find readline you may need to set:export LDFLAGS="-L/usr/local/opt/readline/lib"export CPPFLAGS="-I/usr/local/opt/readline/include"==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.If you need to have sqlite first in your PATH run:echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profileFor compilers to find sqlite you may need to set:export LDFLAGS="-L/usr/local/opt/sqlite/lib"export CPPFLAGS="-I/usr/local/opt/sqlite/include"For pkg-config to find sqlite you may need to set:export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"==> python@2
Pip and setuptools have been installed. To update thempip install --upgrade pip setuptoolsYou can install Python packages withpip install <package>They will install into the site-package directory/usr/local/lib/python2.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python
==> libxml2
libxml2 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.If you need to have libxml2 first in your PATH run:echo 'export PATH="/usr/local/opt/libxml2/bin:$PATH"' >> ~/.bash_profileFor compilers to find libxml2 you may need to set:export LDFLAGS="-L/usr/local/opt/libxml2/lib"export CPPFLAGS="-I/usr/local/opt/libxml2/include"For pkg-config to find libxml2 you may need to set:export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"==> source-highlight
Bash completion has been installed to:/usr/local/etc/bash_completion.d
==> libtool
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.复制代码

再次安装canvas,成功了。

注意

值得注意的是:我这里并没有按照npm install canvas简明指南所说的去安装XQuartz,因为在这之前我通过brew安装了pkg-config。

详细记录一次npm i canvas报错的解决过程相关推荐

  1. vue项目初始化时npm run dev报错webpack-dev-server解决方法

    vue项目初始化时npm run dev报错webpack-dev-server解决方法 参考文章: (1)vue项目初始化时npm run dev报错webpack-dev-server解决方法 ( ...

  2. ffmpeg Operation not permitted 报错的解决过程记录

    问题重现 由于视频的录制过程出现了一些小问题,需要重新将视频文件切割和合并,找了几个视频编辑软件来做这个事情,最终的结果都不是特别满意,当时已经挺晚的了,本来打算上床睡觉第二天再去想辙,从椅子上起身的 ...

  3. 一次显卡报错的解决过程

    症状为: 隔几分钟右下角报错:Display driver 307.68 stopped responding and has recovered Display driver.并且若干次报错后,可能 ...

  4. 奇异问题之解决思路(一) npm run dev或npm run buil报错,单独运行scripts又正常?

    找问题&解决步骤 问题描述 分析产生原因 小小总结下吧 愿佛祖保佑大家无难解决的问题&Bug 问题描述 我想使用rollup打包自己写的一个工具类库,于是手动搭建了一个rollup工程 ...

  5. npm run serve 报错问题 (npm ERR! code ELIFECYCLE)

    记录:npm run serve 报错问题 差点被整吐了,恶心到我了 解决方法 参考的大佬 运行 npm cache clean --force 删除 node_modules 删除 package- ...

  6. npm i报错 npm ERR! path git npm ERR! code ENOENT npm,后续npm i继续报错gyp ERR! node -v v12.13.1

    1,新搭建的环境,node版本,npm版本,Vue-cli版本,webpack版本都应该是最新的,具体版本号如下: 2,之后npm i就报错如下: npm ERR! path git npm ERR! ...

  7. vue打包npm run build报错

    vue打包npm run build报错: 近期领导要求用vue做一个项目,最近在研究和学习vue,在项目打包时一直报错,这个问题困扰了好久,尝试了很多网上办法,但都没有用 电脑每次开机首次执行npm ...

  8. npm run dev 报错:missing script:dev

    错误描述 运行 npm run dev 报错 missing script:dev 原因 查看package.json发现script中并没有dev而是serve.. 所以运行 npm run ser ...

  9. vue 项目初始化时,npm run dev报错解决方法

    vue 项目初始化时,npm run dev报错解决方法 参考文章: (1)vue 项目初始化时,npm run dev报错解决方法 (2)https://www.cnblogs.com/ruilin ...

最新文章

  1. mysql 输出当前月所有日期与对应的星期
  2. redis 启动_Redis介绍amp;安装amp;启动
  3. 谁才是Transformer家族中的最强王者?谷歌告诉你答案
  4. rcp异步多参数实例
  5. 案例分析:程序媛记一次特殊的“故障”处理
  6. 服务器定期监控数据_机房环境监控的实践【斯必得智慧机房 】
  7. WPF入门教程系列十六——WPF中的数据绑定(二)
  8. java 对象嵌套_java如何把嵌套的对象装入集合?
  9. android中倒计时控件CountDownTimer分析
  10. ElasticSearch学习(2)-Java接口操作ElasticSearch
  11. 4k显卡视频测试软件,4K分辨率下体验测试
  12. Java前后端分离项目跨域问题
  13. 存货审计应注意的问题有哪些
  14. Receiver Operating Characteristic(ROC)
  15. android课程设计健身,健身软件课程设计_毕业论文设计.doc
  16. [华硕路由器官方设置]ASUS RT-AC86U官方设置
  17. 一次哔哩哔哩面试经历,看这一篇就够了!
  18. 前端数据可视化之高德地图
  19. error C2059: syntax error : 'constant'
  20. MEM/MBA数学强化(02)实数运算与性质

热门文章

  1. JavaScript隐式类型转换
  2. 设计模式快速学习(五)原型模式
  3. Spring-boot模块化编程
  4. 用WPF实现在ListView中的鼠标悬停Tooltip显示
  5. php 预处理 防注入,PHP防止sql注入小技巧之sql预处理原理与实现方法分析
  6. oracle磁盘组实例启动,12c rac 实例无法启动之磁盘组空间耗尽
  7. 微软官网真的是一个神奇的地方,高清壁纸,直接下载
  8. MuiPlayer视频播放组件入门
  9. Git如何配置多个SSH-Key呢?
  10. [Web Chart系列之五] 图形布局-Circle Layout 之实现