composer安装报错:No composer.lock file present
时间 :
2022-10-28,12:49:20
编辑:临沂网站建设
目前这个No composer.lock file present问题作者菌知道的有两种情况,一种是连接官方默认服务器连接超时导致的,一种就是版本问题.后一种是在网上比较常见的情况,这里临沂网站建设都进行一下举例说明以及问题处理.
1)超时问题:
超时的时候,在给出的报错信息中会给出比较明显的超时信息,如下:
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information. Loading composer repositories with package information In CurlDownloader.php line 365: curl error 28 while downloading https://repo.packagist.org/packages.json: Timeout was reached
这里最后有一个很明显的超时提示.
Timeout was reached
这种情况的解决方法就是使用国内镜像进行连接,当然你有vpn的话另说,不过我个人还是喜欢使用镜像的方法.
使用以下命令可以进行全局设置,这里使用的是阿里云的镜像,其他服务商的镜像地址可以参考 PHP在Composer中使用国内镜像进行设置.
composer config -g repos.packagist composer https://mirrors.aliyun.com/composer/
2)版本问题:
报错信息如下:
No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information. Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages
解决方法:
使用忽略版本的命令进行安装就可以.
composer install --ignore-platform-reqs
转载:欢迎访问临沂网站建站,如果转载本文composer安装报错:No composer.lock file present,请注明本文转载出处。本文链接地址是:/web/393.html
上一篇 :PHP在Composer中使用国内镜像 打印 下一篇 : 没有了!