npm install 细节大全

734 阅读1分钟

1.npm install安装sharp包失败

阿里巴巴提供的一个位于中国的镜像站点


npm config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
npm config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
npm install sharp

2.npm设置镜像

配置淘宝镜像

npm config set registry https://registry.npm.taobao.org

新的淘宝源: npmmirror.com/

推荐使用

npm config set registry=https://registry.npmmirror.com

查看当前使用的镜像地址命令

npm config get registry

如果返回 https://registry.npm.taobao.org,说明镜像配置成功。

切换回原镜像

npm config set registry https://registry.npmjs.org