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

Windows下Docker+WSL部署Laravel Breeze(React)安装失败求助

问题描述

在Windows系统中使用桌面版Docker与WSL,搭配React构建Laravel应用时,执行Composer依赖安装命令失败。操作流程如下:

  • 创建Laravel应用:
    curl -s https://laravel.build/example-app | bash
    cd example-app
    code .
    ./vendor/bin/sail up -d
    ./vendor/bin/sail composer --version
    
  • 执行以下命令时触发报错:
    ./vendor/bin/sail composer require laravel/breeze --dev
    

报错详情

The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
Unzip with unzip command failed, falling back to ZipArchive class
Install of laravel/breeze failed

ZipDownloader.php第223行错误:
The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): ZipArchive::extractTo(/var/www/html/vendor/composer/6270341f/laravel-breeze-1cb124f/LICENSE.md): Operation failed: Operation not permitted

ZipDownloader.php第210行错误:
ZipArchive::extractTo(/var/www/html/vendor/composer/6270341f/laravel-breeze-1cb124f/LICENSE.md): Operation not permitted

解决建议

针对大小写敏感文件系统冲突及权限问题,可尝试以下方案:

1. 配置WSL启用大小写敏感挂载

Windows默认文件系统大小写不敏感,而Linux环境需要大小写敏感支持,修改WSL挂载配置:

  • 打开WSL终端,创建/编辑/etc/wsl.conf文件:
    sudo nano /etc/wsl.conf
    
  • 添加以下内容后保存退出:
    [automount]
    options = "metadata,umask=0022,fmask=0133,case=force"
    
  • 在Windows命令行执行wsl --shutdown关闭WSL,重新启动后生效。

2. 清理Composer缓存后重试

缓存的压缩包可能损坏,清理后重新下载依赖:

./vendor/bin/sail composer clear-cache
./vendor/bin/sail composer require laravel/breeze --dev

3. 手动安装Laravel Breeze

若自动安装持续失败,直接从GitHub下载源码部署:

# 进入项目目录后执行
mkdir -p vendor/laravel/breeze
curl -L https://github.com/laravel/breeze/archive/refs/heads/master.tar.gz | tar xz -C vendor/laravel/breeze --strip-components=1
./vendor/bin/sail composer dump-autoload

4. 修复容器内文件权限

权限异常可能导致解压失败,进入容器调整目录权限:

./vendor/bin/sail shell
chown -R www-data:www-data /var/www/html/vendor
exit

之后重新执行安装命令。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.16 23:27:07