Composer設置忽略版本匹配

最近使用composer安裝時發(fā)現(xiàn)提示php的版本不匹配。執(zhí)行composer install遇到錯誤:Your requirements could not be resolved to an installable set of packages. 這是因為不匹配composer.json要求的版本。

完整錯誤如下:

[PHP]

vagrant@homestead:/usr/share/nginx/html/laravel-1$ sudo composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/instantiator 1.0.3 -> satisfiable by doctrine/instantiator[1.0.3].
    - doctrine/instantiator 1.0.3 requires php ~5.3 -> your PHP version (7.0.3) does not satisfy that requirement.
  Problem 2
    - doctrine/instantiator 1.0.3 requires php ~5.3 -> your PHP version (7.0.3) does not satisfy that requirement.
    - phpunit/phpunit-mock-objects 2.3.0 requires doctrine/instantiator ~1.0,>=1.0.1 -> satisfiable by doctrine/instantiator[1.0.3].
    - Installation request for phpunit/phpunit-mock-objects 2.3.0 -> satisfiable by phpunit/phpunit-mock-objects[2.3.0].

提示我的PHP 7版本太高,不符合composer.json需要的版本,但是在PHP 7下應該也是可以運行的,composer可以設置忽略版本匹配,命令是:

composer install --ignore-platform-reqs

or

composer update --ignore-platform-reqs

再次執(zhí)行composer命令可以正常安裝包了。

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容