当前位置: 代码迷 >> 综合 >> composer 2.0 报错:No composer.json present in the current directory, this may be the cause of the foll
  详细解决方案

composer 2.0 报错:No composer.json present in the current directory, this may be the cause of the foll

热度:26   发布时间:2023-12-09 10:33:22.0

最近将composer升级到2.0,下载包的时候就报错了。
在这里插入图片描述
去 packagist 网站能搜到这个包 https://packagist.org/?query=captcha

那应该是源的问题吧,因为各种镜像源加速都是拷贝的官方的数据到国内。

查看当前使用的哪个源

$ composer config --list repos.packagist[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://packagist.phpcomposer.com
[process-timeout] 300
[use-include-path] false
...

看来我设置的是 https://packagist.phpcomposer.com

取消代理源 composer config -g --unset repos.packagist

确认一下

$ composer config --list repos.packagist
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https?://repo.packagist.org
[repositories.packagist.org.allow_ssl_downgrade] true
[process-timeout] 300
[use-include-path] false

变成了官方源了 repo.packagist.org

再次执行下载
在这里插入图片描述
可以下载了,其实我觉得官网并不算慢。

  相关解决方案