Composer 总是安装失败 symfony/var-dumper

Composer always fails to install symfony/var-dumper

我正在尝试在最新版本的 Homestead 上安装最新版本的 Laravel 8。当我运行composer installcomposer update时,安装symfony/var-dumper总是失败:

Installing symfony/var-dumper (v5.2.6): Extracting archive
Install of symfony/var-dumper failed

[ErrorException]
file_get_contents(/home/vagrant/code/vendor/symfony/var-dumper/Resources/bin/var-dump-server): 
    Failed to open stream: No such file or directory

尽管出现错误异常,文件/vendor/symfony/var-dumper/Resources/bin/var-dump-server确实存在。

我尝试过的事情:

我总是遇到同样的错误。

这原来是与 Composer 2.x 的兼容性问题。我使用composer self-update --1降级到1.x频道,然后再次运行composer install,安装成功。

删除 /vendor 文件夹,然后 运行:

composer update -v

Composer version 2.2.4 2022-01-08 12:30:42

symfony/var-dumper v5.4.3

工作正常