這篇文章主要介紹Composer常見錯誤是什么,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
成都創(chuàng)新互聯(lián)專注于萬山企業(yè)網(wǎng)站建設,響應式網(wǎng)站設計,商城系統(tǒng)網(wǎng)站開發(fā)。萬山網(wǎng)站建設公司,為萬山等地區(qū)提供建站服務。全流程定制制作,專業(yè)設計,全程項目跟蹤,成都創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務
Composer常見錯誤解決方案
執(zhí)行composer install遇到錯誤:Your requirements could not be resolved to an installable set of packages. 這是因為不匹配composer.json要求的版本。
完整錯誤如下:
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下應該也是可以運行的,composer可以設置忽略版本匹配,命令是:
composerinstall --ignore-platform-reqs
或者
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
這是在虛擬機中執(zhí)行composer,提示這個目錄沒有可寫權限,composer無法緩存下載的包,這樣就每次都得重新下載,把目錄改成可寫可讀即可。
sudo chmod -R 777 /home/vagrant/.composer/cache/files/
另外,在虛擬機中也設置composer為國內鏡像,不然下載速度慢的要死,執(zhí)行:
composerconfig -g repo.packagistcomposerhttps://packagist.phpcomposer.com
以上是“Composer常見錯誤是什么”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
標題名稱:Composer常見錯誤是什么
本文網(wǎng)址:http://aaarwkj.com/article8/gghgop.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供、做網(wǎng)站、網(wǎng)站改版、自適應網(wǎng)站、外貿建站、網(wǎng)站內鏈
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)