代码先锋网 代码片段及技术文章聚合

安装sharp包的注意事项

技术标签: node.js  sharp  安装

sharp包是基于node.js的高性能图片处理器

在使用npm安装sharp的时候,需要注意以下问题

  • 使用镜像地址:
npm config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips"
  • 提前下载好sharp某版本号对应的libvips依赖包,放在npm的缓存路径中,通常这个路径是/Users/<username>/.npm/_libvips(在使用了nvm管理node版本的情况下)

如果没有提前下载好并放在缓存中,可能会出现如下的报错信息

info sharp Using cached /Users/<usernmae>/.npm/_libvips/libvips-8.10.0-darwin-x64.tar.br
ERR! sharp Decompression failed
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
  TOUCH Release/obj.target/libvips-cpp.stamp
  CC(target) Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
  CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:24:10: fatal error: 'vips/vips8' file not found
#include <vips/vips8>
         ^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/maxingyuan/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/Users/<usernmae>/.nvm/versions/node/v12.16.1/bin/node" "/Users/<usernmae>/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/maxingyuan/.nvm/versions/node/v12.16.1/lib/node_modules/sharp
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /Users/<usernmae>/.npm/_logs/2020-11-11T07_51_13_893Z-debug.log
版权声明:本文为mxydl2009原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/mxydl2009/article/details/109626900

智能推荐

centos上安装python包的一些注意事项

大多数开发人员都在部署服务器的时候,都只是一个普通用户,没有root权限,而在正常使用pip此类的指令安装python包的时候就会需要sudo命令 参考Stack Overflow给出解决方案,适用于python2.7, python3.x 1. 安装pip 若是python3.x 就把上面的 python 改为 python3 一定记得使用 –user 参数否则你还是没有权限 安装完...

apache安装注意事项

Apache静态编译和动态编译 静态 在使用./configure编译的时候,如果不指定某个模块为动态,即没有使用:enable-mods-shared=module或者enable-module=shared这个2个中的一个,那么所有的默认模块为静态。那么何谓静态? 其实就是编译的时候所有的模块自己编译进httpd这个文件中(我们启动可以使用这个执行文件,如:./httpd &),启动的...

PyAV安装注意事项

PyAV提供了ffmpeg的python接口,使得python用户也可以使用ffmpeg。但是PyAV相较于其他python包安装要复杂些,因为它是以ffmpeg作为后端,所以要先安装ffmpeg。具体来说就是下载ffmpeg shared,并将其目录下的bin目录添加到环境变量。然后有两种方式安装PyAV 1、通过pip安装 2、通过源码编译安装 到GitHub下载PyAV源码,解压后进入其目录...

hadoop 安装注意事项

   最近需要研究hadoop,昨天开始搭建环境。网上有相关的教程,可以参考http://wenku.baidu.com/view/9638bc0d4a7302768e9939ca.html      但是在安装过程中也出现了一些问题,需要注意的。  1.还需要设置    在hdfs.site.xml中设置的属性dfs...

LNMP 安装注意事项

关于LNMP的安装,见这个帖子: http://blog.csdn.net/kimsoft/article/details/7100595( LNMP 最新版本+YUM方式安装指南(CentOS5.5 + Nginx 1.0.x + MySQL 5.5.x + PHP 5.3.x)) 安装要注意几点: 一、Nginx + PHP的组合,问题多出在配置上,解决办法有多种,不废话,直接上配置 假定:/...

猜你喜欢

Phalcon安装注意事项

 第二步   注意:这是centos的安装,php版本是5.6,通过yum安装的版本, 第三步,把extension=phalcon.so 加入php.ini文件这个是官网的说法,实际是   ...

Ambari安装注意事项

1、 集群命名规则 NSCD 全域名  以.分割 2、 数据库安装完成后创建ambari用户及库 create database ambari; CREATE USER 'ambari'@'%'IDENTIFIED BY 'Ambari-123'; GRANT ALL PRIVILEGES ON *.* TO 'ambari'@'%'; FLUSH PRIVILEGES; mysql a...

vim安装注意事项

1 安装一些必要的软件   sudo apt-get install cmake   sudoapt-get install vim   sudoapt-get install vim-gnome   sudoapt-get install ctags source$VIMRUNTIME/mswin.vim "支持ctrl+cctrl+v复制粘贴功...

openMVG 安装注意事项

Windows 安装注意事项: 问题1: openMVG 默认使用的Eigen 是安装在C盘,因此需要管理员权限下打开VS 编译;  或许可以把openMVG默认使用的Eigen设置为我们D盘自己安装的Eigen,这个还没有试。 问题2: openMVG : debug版生成的库,和release 版生成的库 ,库名都一样。 因此: 如果先编译Debug 版,后编译Releas...

系统安装注意事项

安装前首先确认网络是否配置好,命令为: 防火墙是否关闭,关闭防火墙的命令为: 时间是否同步,时间(上海)同步命令为: 查看端口是否被占用,命令为: 或 vnc若出现灰屏,解决命令为: 设置开机启动命令为: 机房意外断电后,服务器启动注意事项: 先启动zookeeper,命令为: 再通过如下命令启动dubbo: 再启动ActiveMQ,通过如下命令: 再启动redis 启动mysql: 最后启动PT...