MENU

pnpm安装sharp报错处理办法

• 2024 年 12 月 25 日 • 阅读: 336 • 躺过的坑

报错内容如下:

PS F:\myproject> pnpm i
WARN  4 deprecated subdependencies found: @esbuild-kit/core-utils@3.3.2, @esbuild-kit/esm-loader@2.6.5, glob@7.2.3, inflight@1.0.6
Packages: +946
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 1045, reused 942, downloaded 5, added 946, done
node_modules/.pnpm/esbuild@0.23.1/node_modules/esbuild: Running postinstall script, done in 660ms
node_modules/.pnpm/esbuild@0.18.20/node_modules/esbuild: Running postinstall script, done in 534ms
node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild: Running postinstall script, done in 508ms
node_modules/.pnpm/sharp@0.32.6/node_modules/sharp: Running install script, failed in 348ms
.../sharp@0.32.6/node_modules/sharp install$ (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
│ sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-win32-x64.tar.br
│ sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
└─ Failed in 348ms at F:\myproject\node_modules\.pnpm\sharp@0.32.6\node_modules\sharp
 ELIFECYCLE  Command failed with exit code 1.
 WARN  4 deprecated subdependencies found: @esbuild-kit/core-utils@3.3.2, @esbuild-kit/esm-loader@2.6.5, glob@7.2.3, inflight@1.0.6
Packages: +946
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.../sharp@0.32.6/node_modules/sharp install$ (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
│ sharp: Installation error: connect ECONNREFUSED 127.0.0.1:443
│ sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
└─ Failed in 326ms at F:\myproject\node_modules\.pnpm\sharp@0.32.6\node_modules\sharp
node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild: Running postinstall script, done in 275ms
node_modules/.pnpm/esbuild@0.18.20/node_modules/esbuild: Running postinstall script, done in 293ms
 ELIFECYCLE  Command failed with exit code 1.

解决方案:

pnpm config set sharp_binary_host=https://npmmirror.com/mirrors/sharp
pnpm config set sharp_libvips_binary_host=https://npmmirror.com/mirrors/sharp-libvips