溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何解決composer安裝composer包報Your requirements could not be resolved

發(fā)布時間:2021-02-23 13:28:41 來源:億速云 閱讀:516 作者:小新 欄目:軟件技術(shù)

這篇文章主要介紹如何解決composer安裝composer包報Your requirements could not be resolved,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

一:使用composer安裝composer包時遇到Y(jié)our requirements could not be resolved to an installable set of packages
如何解決composer安裝composer包報Your requirements could not be resolved

分析:
這是由于doctrine/instantiator的1.1.0版本必須是PHP7.1,然而我的PHP環(huán)境是PHP7.0.12,但是我發(fā)現(xiàn)一個問題,我的composer.json文件內(nèi)沒有doctrine/instantiator包信息,那么為什么回報這樣一個錯誤呢?
這時候我找到vendor/doctrine/instantiator發(fā)現(xiàn)doctrine/instantiator包已經(jīng)安裝在我的框架中了,打開vendor/doctrine/instantiator目錄下的composer.json文件發(fā)現(xiàn),這個包所需要的環(huán)境是PHP7.1:
如何解決composer安裝composer包報Your requirements could not be resolved

找到doctrine/instantiator包的地址:https://packagist.org/package...

這時候發(fā)現(xiàn)doctrine/instantiator的1.1.0版本所需的PHP環(huán)境為7.1,所以我想是不是由于我的框架中的doctrine/instantiator包的版本是1.1.0導(dǎo)致在這個框架中安裝composer包失敗的呢?

解決:
1:將doctrine/instantiator包的版本變?yōu)槲覀冃枰陌姹?這里我將doctrine/instantiator包的版本變?yōu)?.0.x-dev)

composer require doctrine/instantiator "1.0.x-dev"

2:將doctrine/instantiator包變?yōu)樗枰陌姹竞笤侔惭b你需要的composer包,這時候就不會報錯誤了(這里我以huaweichenai/baidu-discern包為例)
如何解決composer安裝composer包報Your requirements could not be resolved

這是使用composer安裝就成功了

網(wǎng)上有一種方法:使用 composer install --ignore-platform-reqs 命令設(shè)置忽略版本匹配然后再進(jìn)行安裝你所需要的composer包,這種方法我進(jìn)行測試后發(fā)現(xiàn)還是報錯,具體為什么就不清楚了,有知道為什么的歡迎留言告訴博主
如何解決composer安裝composer包報Your requirements could not be resolved

以上是“如何解決composer安裝composer包報Your requirements could not be resolved”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI