1.错误重现:创建一个tp5的项目

E:\PHP\FrameWork>composer create-project topthink/think tp5 --prefer-dist -vvv

报错如下:

Failed to initialize global composer: Composer could not find the config file: C:/Users/Mr.cai/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section...

一直为无响应状态。

Composer中创建tp5项目报错:Failed to initialize global composer: Composer could not find the config ...

考虑到是否是这个镜像的原因呢,我们可以更换一个镜像,更改composer的全局配置。

 

2.解决方式

执行命令

composer config -g repo.packagist composer https://packagist.phpcomposer.com

 

然后再次创建一个项目试试。

E:\PHP\FrameWork>composer create-project topthink/think tp5 --prefer-dist -vvv

这次创建很快就完成了。

Composer中创建tp5项目报错:Failed to initialize global composer: Composer could not find the config ...

Composer中创建tp5项目报错:Failed to initialize global composer: Composer could not find the config ...

 

相关文章:

  • 2021-05-17
  • 2021-10-18
  • 2021-07-31
  • 2021-10-19
  • 2021-11-29
  • 2021-06-11
  • 2021-12-14
猜你喜欢
  • 2021-06-22
  • 2022-01-11
  • 2021-07-27
  • 2021-10-12
  • 2021-04-12
  • 2021-04-04
  • 2021-05-26
相关资源
相似解决方案