Composer require 報(bào)錯(cuò) Installation failed, reverting ./composer.json and ./composer.lock to their ....

在安裝 thinkphp swoole 的時(shí)候,

composer require topthink/think-swoole

報(bào)錯(cuò)如下:

 Installation failed, reverting ./composer.json and ./composer.lock to their original content.

解決方法:
1、把需要引入的包寫入 composer.json 中(寫入的話,就不需要 composer require 了,直接composer update 即可。)

2、刪除 composer.lock

3、$ composer clearcache 清除緩存

4、$ composer update 更新依賴(重新生成 composer.lock)

例如:
上面的 topthink/think-swoole 組件,將它加入到 composer.json 的 require 對(duì)象里面,如果只是開發(fā)環(huán)境使用,就加入到 require-dev,然后按照上面步驟操作一遍:

 "require": {
        "php": ">=7.1.0",
        "topthink/framework": "^6.0.0",
        "topthink/think-orm": "^2.0",
        "topthink/think-queue": "^3.0",
        "predis/predis": "^1.1",
        "marlon/thinkphp-redis": "^0.0.3",
        "liliuwei/thinkphp-jump": "^1.5",
        "topthink/think-swoole":"^3.1.0"
    },
    "require-dev": {
        "symfony/var-dumper": "^4.2",
        "topthink/think-trace":"^1.0"
    },

建議看我comoser文集下另外一篇文章 也可解決該問題 ,更簡(jiǎn)單直接點(diǎn);

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

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

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