php composer.phar install大量报错could not be found in any version, there may be a typo in the package name

报错原因:

在执行php composer.phar后,再执行

1
php composer.phar install

后如下图报错。

报错示例:

php composer.phar install大量报错could not be found in any version, there may be a typo in the package name

php composer.phar install大量报错could not be found in any version, there may be a typo in the package name

我知道是执行下面命令修改了composer全局配置文件的默认地址改为中国镜像地址后出现这个情况的

1
composer config -g repo.packagist composer https://packagist.phpcomposer.com  //默认地址改为中国镜像地址

解决方法:

折腾半天不知道怎么回事,后来突然想到要改 composer全局配置文件的镜像地址改回为国外默认镜像地址 ,使用下面命令:

1
composer config -g repo.packagist composer https://packagist.org  //镜像地址改为成默认国外地址

修改为国外地址后,再次执行

1
php composer.phar install

php composer.phar install大量报错could not be found in any version, there may be a typo in the package name