這篇文章主要介紹了Composer常見錯(cuò)誤有哪些,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

執(zhí)行composer install遇到錯(cuò)誤:Your requirements could not be resolved to an installable set of packages. 這是因?yàn)椴黄ヅ鋍omposer.json要求的版本。
完整錯(cuò)誤如下:
vagrant@homestead:/usr/share/nginx/html/laravel-blog$ sudocomposerinstall Loadingcomposerrepositorieswithpackage information Installingdependencies (includingrequire-dev) fromlockfile Yourrequirementscouldnot beresolvedto aninstallablesetofpackages. Problem 1 - Installationrequestfor doctrine/instantiator 1.0.3 -> satisfiablebydoctrine/instantiator[1.0.3]. - doctrine/instantiator 1.0.3 requiresphp ~5.3 -> yourPHPversion (7.0.3) doesnot satisfythatrequirement. Problem 2 - doctrine/instantiator 1.0.3 requiresphp ~5.3 -> yourPHPversion (7.0.3) doesnot satisfythatrequirement. - phpunit/phpunit-mock-objects 2.3.0 requiresdoctrine/instantiator ~1.0,>=1.0.1 -> satisfiablebydoctrine/instantiator[1.0.3]. - Installationrequestfor phpunit/phpunit-mock-objects 2.3.0 -> satisfiablebyphpunit/phpunit-mock-objects[2.3.0].
提示我的PHP 7版本太高,不符合composer.json需要的版本,但是在PHP 7下應(yīng)該也是可以運(yùn)行的,composer可以設(shè)置忽略版本匹配,命令是:
composerinstall --ignore-platform-reqs or composerupdate --ignore-platform-reqs
再次執(zhí)行composer命令可以正常安裝包了。
如果提示警告:
Cannotcreatecachedirectory /home/vagrant/.composer/cache/repo/https---packagist.org/, or directoryis not writable. Proceedingwithoutcache Cannotcreatecachedirectory /home/vagrant/.composer/cache/files/, or directoryis not writable. Proceedingwithoutcache
這是在虛擬機(jī)中執(zhí)行composer,提示這個(gè)目錄沒有可寫權(quán)限,composer無法緩存下載的包,這樣就每次都得重新下載,把目錄改成可寫可讀即可。
sudo chmod -R 777 /home/vagrant/.composer/cache/files/
另外,在虛擬機(jī)中也設(shè)置composer為國內(nèi)鏡像,不然下載速度慢的要死,執(zhí)行:
composerconfig -g repo.packagistcomposerhttps://packagist.phpcomposer.com
OK,大功告成。
感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Composer常見錯(cuò)誤有哪些”這篇文章對大家有幫助,同時(shí)也希望大家多多支持創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!
標(biāo)題名稱:Composer常見錯(cuò)誤有哪些-創(chuàng)新互聯(lián)
文章轉(zhuǎn)載:http://www.chinadenli.net/article44/igiee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、外貿(mào)建站、移動(dòng)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、外貿(mào)網(wǎng)站建設(shè)、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容