ThinkPHP5通过composer安装Workerman安装失败问题(避坑指南)

简介: ThinkPHP5通过composer安装Workerman安装失败问题(避坑指南)

今天在tp5下安装Workerman时出现了以下问题

$ composer require topthink/think-worker
Using version ^2.0 for topthink/think-worker
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - topthink/think-worker v2.0.9 requires topthink/framework ^5.1.18 -> satisfiable by topthink/framework[5.1.x-dev, 5.2.x-dev, v5.1.18, v5.1.19, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.30, v5.1.31, v5.1.32, v5.2-beta.2] but these conflict with your requirementsor minimum-stability.
    - topthink/think-worker v2.0.8 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.7 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.6 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.5 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.4 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.3 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.2 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.11 requires topthink/framework ^5.1.18 -> satisfiable by topthink/framework[5.1.x-dev, 5.2.x-dev, v5.1.18, v5.1.19, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.30, v5.1.31, v5.1.32, v5.2-beta.2] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.10 requires topthink/framework ^5.1.18 -> satisfiable by topthink/framework[5.1.x-dev, 5.2.x-dev, v5.1.18, v5.1.19, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.30, v5.1.31, v5.1.32, v5.2-beta.2] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.1 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.0 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - Installation request for topthink/think-worker ^2.0 -> satisfiable by topthink/think-worker[v2.0.0, v2.0.1, v2.0.10, v2.0.11, v2.0.2, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7, v2.0.8, v2.0.9].
Installation failed, reverting ./composer.json to its original content.

以上信息显示composer在更新composer.json文件后,在安装依赖时报错Your requirements could not be resolved to an installable set of packages,意思就是请求无法解析为可用的安装包,为什么呢?

我们来看提示部分问题,告诉我们topthink/think-worker v2.0.*相关版本需要依赖的是TP5.1版本,而我的TP版本是5.0.*

 Problem 1
    - topthink/think-worker v2.0.9 requires topthink/framework ^5.1.18 -> satisfiable by topthink/framework[5.1.x-dev, 5.2.x-dev, v5.1.18, v5.1.19, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.30, v5.1.31, v5.1.32, v5.2-beta.2] but these conflict with your requirementsor minimum-stability.
    - topthink/think-worker v2.0.8 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.7 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.6 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.5 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.4 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.3 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.2 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.11 requires topthink/framework ^5.1.18 -> satisfiable by topthink/framework[5.1.x-dev, 5.2.x-dev, v5.1.18, v5.1.19, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.30, v5.1.31, v5.1.32, v5.2-beta.2] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.10 requires topthink/framework ^5.1.18 -> satisfiable by topthink/framework[5.1.x-dev, 5.2.x-dev, v5.1.18, v5.1.19, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.30, v5.1.31, v5.1.32, v5.2-beta.2] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.1 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - topthink/think-worker v2.0.0 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[5.1.x-dev, v5.1-beta.1, v5.1-rc.1, v5.1-rc.2, v5.1-rc.3, v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9] but these conflict with your requirements or minimum-stability.
    - Installation request for topthink/think-worker ^2.0 -> satisfiable by topthink/think-worker[v2.0.0, v2.0.1, v2.0.10, v2.0.11, v2.0.2, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7, v2.0.8, v2.0.9].

明确了问题,那我们在安装topthink/think-worker时就相应选择低版本的,这里我们尝试使用1.0.*版本的

$ composer require topthink/think-worker=1.0.*
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 11 installs, 0 updates, 0 removals
  - Installing topthink/think-installer (v1.0.12): Downloading (100%)
  - Installing topthink/framework (v5.0.23): Downloading (100%)
  - Installing topthink/think-image (v1.0.7): Downloading (100%)
  - Installing topthink/think-captcha (v1.0.7): Downloading (100%)
  - Installing topthink/think-mongo (v1.8.5): Downloading (100%)
  - Installing topthink/think-migration (v1.1.1): Downloading (100%)
  - Installing topthink/think-helper (v1.0.7): Downloading (100%)
  - Installing topthink/think-queue (v1.1.6): Downloading (100%)
File application\extra\queue.php exist!
  - Installing phpmailer/phpmailer (v6.0.6): Downloading (100%)
  - Installing workerman/workerman (v3.5.17): Loading from cache
  - Installing topthink/think-worker (v1.0.1): Downloading (100%)
phpmailer/phpmailer suggests installing psr/log (For optional PSR-3 debug logging)
phpmailer/phpmailer suggests installing league/oauth2-google (Needed for GoogleXOAUTH2 authentication)
phpmailer/phpmailer suggests installing hayageek/oauth2-yahoo (Needed for YahooXOAUTH2 authentication)
phpmailer/phpmailer suggests installing stevenmaguire/oauth2-microsoft (Needed for Microsoft XOAUTH2 authentication)
phpmailer/phpmailer suggests installing symfony/polyfill-mbstring (To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2))
workerman/workerman suggests installing ext-event (For better performance. )
Writing lock file
Generating autoload files

安装成功后,根据tp5.0官方手册,如果需要在windows下做服务端,还需要安装workerman/workerman-for-win

$ composer require workerman/workerman-for-win
Using version ^3.5 for workerman/workerman-for-win
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing workerman/workerman-for-win (v3.5.1):Downloading (100%)         )
Writing lock file
Generating autoload files
目录
相关文章
|
2月前
|
资源调度 jenkins 持续交付
jenkins 自动安装nodejs16.16.0版本报错处理
jenkins 自动安装nodejs16.16.0版本报错处理
98 0
|
7月前
|
小程序 Linux Shell
linux安装及使用composer
curl -sS https://getcomposer.org/installer | php
106 0
|
12月前
|
缓存 Linux PHP
PHP快速入门14-Composer包管理安装与使用,附常见的20个使用例子
PHP Composer 是 PHP 的一个包管理工具,它被广泛用于 PHP 应用程序的依赖管理。Composer 可以自动查找和下载 PHP 应用所需要的第三方类库和组件,并将它们集成到应用程序中。
260 0
|
11月前
|
PHP
PHP - Laravel VSCode 自用插件
PHP - Laravel VSCode 自用插件
275 0
|
设计模式 前端开发 PHP
PHP的Laravel与Composer部署项目时常见问题
我们在部署PHP项目时,其实大部分的PHP项目会创建环境检测与一键Install页面。 但是,有许多的项目还采用了Composer部署。
342 0
|
运维 PHP
【常见问题】宝塔面板如何安装最新版本的php扩展swoole
宝塔面板能提高我们非运维专业人员的管理效率,但是也会损失一些灵活性,要根据需求灵活使用工具。
377 0
|
Linux PHP
easyswoole一键安装脚本,宝塔安装错误
需要注意的是,这只是几句很简单的命令,并且在文档中都有出现。只是文档有比较多的场景描述,可能导致有些新人没有细心观看到。
103 0
|
XML 前端开发 安全
Laravel安装指南
Laravel 8 通过引入 Laravel Jetstream,模型工厂类,迁移压缩,队列批处理,改善速率限制,队列改进,动态 Blade 组件,Tailwind 分页视图, 时间测试助手,artisan serve 的改进,事件监听器的改进,以及各种其他错误修复和可用性改进,对 Laravel 7.x 继续进行了改善。
536 0
|
安全 PHP
composer的基本使用和常见报错解决
composer的基本使用和常见报错解决
384 0
|
前端开发 Linux PHP
基于xampp集成环境安装composer
基于xampp集成环境安装composer
795 0
基于xampp集成环境安装composer