在一些接近最新版本的composer依赖包安装中,会出现如下错误。
D:\code\php\laravel_project>composer install
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires fideloper/proxy, it could not be found in any version, there may be a typo in the package name.
Problem 2
- Root composer.json requires laravel/framework, it could not be found in any version, there may be a typo in the package name.
Problem 3
- Root composer.json requires laravel/tinker, it could not be found in any version, there may be a typo in the package name.
Problem 4
- Root composer.json requires facade/ignition, it could not be found in any version, there may be a typo in the package name.
Problem 5
- Root composer.json requires fakerphp/faker, it could not be found in any version, there may be a typo in the package name.
Problem 6
- Root composer.json requires mockery/mockery, it could not be found in any version, there may be a typo in the package name.
Problem 7
- Root composer.json requires nunomaduro/collision, it could not be found in any version, there may be a typo in the package name.
Problem 8
- Root composer.json requires phpunit/phpunit, it could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
- It's a private package and you forgot to add a custom repository to find it
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
是我在部署laravel 8.x时,composer install 报的错误。
网上查了好几个小时,也没查到几个答案,大部分时间是根据网上七七八八的信息自己琢磨,唯一,不,唯俩像个答案的,
一个是让我们把composer.json里的依赖包版本描述中 ^ 改成 ~,扯淡,那是人家要求的最低版本要求,改成反向,还怎么用人家的包呢。
另一个是说把composer.json中的"minimum-stability": "dev" 放到 require之前,也是扯淡。
我之所以一直没有自己琢磨出原因是因为,安装的composer最新版2.x,也不知道为什么默认包来源地址为国内镜像 https://packagist.phpcomposer.com,我是绝对没有设置过的。
包来源地址查询命令: composer config -l -g
然后我就一直在 https://packagist.org/explore/ 中查找具体报错的包版本,明明有,然后就没有怀疑到地址。
几乎在放弃的时候,幸运的看到一个博主(https://blog.csdn.net/bluehire/article/details/81530747)因为地址问题出现该错误,我也抱着万一的态度,查了一下自己的包来源地址,果然是不对。
执行命令: composer config -g repo.packagist composer https://packagist.org
而后composer install完美成功。
不管你是用在哪个项目中,如果是报这个错误,先检查一下自己的包来源地址吧,毕竟拉来别人的开源项目,人家composer.json的版本(几乎)不可能要求错了呀。