利用sharp来resize 图片

安装

参考: http://sharp.pixelplumbing.com/en/stable/install/

在Mac Pro上面直接使用npm install --save sharp 安装会报错。根据报错可以发现sharp依赖libxmljs (https://www.npmjs.com/package/libxmljs) , libxmljs 的安装需要node-gyp (https://github.com/nodejs/node-gyp#installation)。 总之很麻烦,解决办法就是更新node-gyp,参考: https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp