处理 PHP 开发版本问题
2022-12-02 09:01:16
85
{{single.collect_count}}
在安装一个开源项目时,作者本地用了 PHP 7.1 进行开发,而我本地是 PHP 7.0, 于是悲剧发生了,出现了这样的错误:requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement..

一、Composer 安装包

composer install 之后报错

vagrant@homestead:~/Code/sample$ composer installLoading composer repositories with package informationInstalling dependencies (including require-dev) from lock fileYour requirements could not be resolved to an installable set of packages.Problem 1- Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement.Problem 2- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.13) does not satisfy that requirement.- phpunit/phpunit-mock-objects 2.3.8 requires doctrine/instantiator ^1.0.2 -> satisfiable by doctrine/instantiator[1.1.0].- Installation request for phpunit/phpunit-mock-objects 2.3.8 -> satisfiable by phpunit/phpunit-mock-objects[2.3.8].
登录后复制

二、解决方法

删除 composer.lock 文件,重新执行 composer install,这样就能重新生成 composer.lock 文件了。

composer 包自动加载后,会生成一个 composer.lock 锁文件,所以,在从GitHub拉取别人的代码后,需要对这个文件进行删除。

推荐:《PHP视频教程

php入门到就业线上直播课:立即学习
全程直播 + 实战授课 + 边学 + 边练 + 边辅导

以上就是处理 PHP 开发版本问题的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}