在安装 thinkphp swoole 的时候,
composer require topthink/think-swoole
报错如下:
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 对象里面,如果只是开发环境使用,就加入到 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文集下另外一篇文章 也可解决该问题 ,更简单直接点;