yarn 安装sharp出现报错
错误信息:
error /Users/xxx/Desktop/work-space/sanitation-app/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: /Users/xxx/Desktop/work-space/sanitation-app/node_modules/sharp
Output:
sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.4/libvips-8.14.4-darwin-arm64v8.tar.br
sharp: Installation error: Request timed out
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
原因很明显:下不动了 解决方案有两种
- 换个好点的vpn,挂github代理
- 更换sharp源
yarn config set sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
yarn config set sharp_binary_host "https://npmmirror.com/mirrors/sharp"
or
code ~/.yarnrc 添加以下配置
sharp_binary_host "https://npmmirror.com/mirrors/sharp"
sharp_libvips_binary_host "https://npmmirror.com/mirrors/sharp-libvips"
执行yarn 就好