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

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 ..._第1张图片

考虑到是否是这个镜像的原因呢,我们可以更换一个镜像,更改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 ..._第2张图片

Composer中创建tp5项目报错:Failed to initialize global composer: Composer could not find the config ..._第3张图片

 

你可能感兴趣的:(Composer,PHP)