将 laravel 从 6.03 更新到 6.18 时出错

Error while updating laravel from 6.03 to 6.18

我在尝试将我的 Laravel 从 6.03 升级到 6.18 时出现此错误 无法删除 D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate: 这可能是由于防病毒软件或 Windows 搜索索引器在分析文件时锁定了文件

PS D:\xampp\htdocs\XXXXX> composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 5 installs, 35 updates, 0 removals
  - Updating laravel/framework (v6.0.3 => v6.18.35):     Update failed (Could not delete D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate:
This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed)
    Would you like to try reinstalling the package instead [yes]?
  - Removing laravel/framework (v6.0.3)


  [RuntimeException]
  Could not delete D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate:
  This can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...

PS D:\xampp\htdocs\BaladyFreshFarm>

您可以尝试删除 D:\xampp\htdocs\BaladyFreshFarm\vendor/laravel/framework\src\Illuminate 手动。如果这不起作用,请尝试重新启动并关闭防病毒软件,然后重试。

运行 你的 IDE 或管理员之类的终端,然后重试。

同样的事情发生在我身上,经过几个小时的调试我发现:

  • 确保您的 vscode 或 powershell 或 cmd 具有“管理”权限。
  • 确保您的网络服务器工作正常。

不该做的事:
在我的情况下,代理没有任何问题,只是许可和工作网络 服务器。但是我必须重新安装 xampp 才能正确解决这个问题,因为我在调试时篡改了一些文件

今天我运行遇到了这个问题。删除供应商文件夹,然后执行 composer install。那应该可以解决问题。