cenots 6 安装node-canvas 报错

官网未提供在centos上安装node-canvas的教程,今天给搞定了。

canvas

Canvas graphics API backed by Cairo

https://www.npmjs.com/package/canvas

github.com/Automattic/node-canvas

Get start for Cenots

install Cairo


sudo yum install cairo cairo-devel cairomm-devel libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel giflib-devel

install C++11 compiler


# 不推荐

# sudo yum install centos-release-scl

# sudo yum-config-manager --enable rhel-server-rhscl-7-rpms

# sudo yum install devtoolset-3-gcc-c++


# scl enable devtoolset-3 bash


# 推荐

yum remove gcc gcc-g++

curl -Lks http://www.hop5.in/yum/el6/hop5.repo > /etc/yum.repos.d/hop5.repo

yum install gcc gcc-g++

gcc --version

install node-gyp

https://www.npmjs.com/package/node-gyp


npm install -g node-gyp

#python (v2.7 recommended, v3.x.x is not supported)


install canvas

npm install canvas

Copyright © bqxu.me. 2016 • All rights reserved.