You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

搭建Payload CMS电商项目时Sharp包安装请求超时问题求助

Payload CMS电商项目npm依赖安装失败问题

问题场景

基于Payload CMS模板搭建电商项目,将项目推送到GitHub后克隆到本地,执行npm install --legacy-peer-deps安装依赖时出现错误。

错误日志

PS C:\Users\FPCC\Desktop\WEB DEV\e-commerce-cms> npm install --legacy-peer-deps
npm WARN deprecated memfs@3.6.0: this will be v4
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Users\\FPCC\\Desktop\\WEB DEV\\e-commerce-cms\\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\FPCC\Desktop\WEB DEV\e-commerce-cms\node_modules\@aws-crypto'] {     
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Users\\FPCC\\Desktop\\WEB DEV\\e-commerce-cms\\node_modules\\@aws-crypto'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Users\FPCC\Desktop\WEB DEV\e-commerce-cms\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.14.5/libvips-8.14.5-win32-x64.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: Request timed out

npm ERR! A complete log of this run can be found in: C:\Users\FPCC\AppData\Local\npm-cache\_logs\2023-12-08T17_17_02_626Z-debug-0.log

已尝试但无效的解决方法

  • 在独立项目中单独安装sharp包,安装成功
  • 使用NVM切换Node.js版本(16、18、21及最新版)
  • 移除项目package.json中的sharp包,先安装其他依赖后再单独安装sharp
  • 执行npm install --platform=win32 --arch=x64 sharp单独安装sharp
  • 使用yarn安装所有依赖

内容的提问来源于stack exchange,提问作者Yazan Ali

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 17:05:14