Composer常見錯誤有哪些-創(chuàng)新互聯

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

創(chuàng)新互聯堅信:善待客戶,將會成為終身客戶。我們能堅持多年,是因為我們一直可值得信賴。我們從不忽悠初訪客戶,我們用心做好本職工作,不忘初心,方得始終。10年網站建設經驗創(chuàng)新互聯是成都老牌網站營銷服務商,為您提供成都做網站、成都網站設計、成都外貿網站建設、網站設計、H5響應式網站、網站制作、品牌網站制作、成都微信小程序服務,給眾多知名企業(yè)提供過好品質的建站服務。

執(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
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

這是在虛擬機中執(zhí)行composer,提示這個目錄沒有可寫權限,composer無法緩存下載的包,這樣就每次都得重新下載,把目錄改成可寫可讀即可。

sudo chmod -R 777 /home/vagrant/.composer/cache/files/

另外,在虛擬機中也設置composer為國內鏡像,不然下載速度慢的要死,執(zhí)行:

composerconfig -g repo.packagistcomposerhttps://packagist.phpcomposer.com

OK,大功告成。

感謝你能夠認真閱讀完這篇文章,希望小編分享的“Composer常見錯誤有哪些”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯網站建設公司,,關注創(chuàng)新互聯行業(yè)資訊頻道,更多相關知識等著你來學習!

標題名稱:Composer常見錯誤有哪些-創(chuàng)新互聯
文章轉載:http://bm7419.com/article44/igiee.html

成都網站建設公司_創(chuàng)新互聯,為您提供關鍵詞優(yōu)化、外貿建站、移動網站建設、網站設計外貿網站建設、App開發(fā)

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯

網站托管運營