walkor / webman

Probably the fastest PHP web framework in the world.
https://webman.workerman.net/
MIT License
2.16k stars 214 forks source link

composer require 报错 #375

Closed winson-young closed 1 year ago

winson-young commented 1 year ago

我在运行安装以下依赖时会报错: composer require webman/event -vvv

Running 2.5.7 (2023-05-24 15:00:39) with PHP 7.4.27 on Linux / 4.15.0-210-generic
Reading ./composer.json (/mnt/projects/app-backend/composer.json)
Loading config file ./composer.json (/mnt/projects/app-backend/composer.json)
Checked CA file /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/mnt/projects/app-backend): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/mnt/projects/app-backend): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/mnt/projects/app-backend): git log --pretty="%H" -n1 HEAD
Executing command (/mnt/projects/app-backend): hg branch
Executing command (/mnt/projects/app-backend): fossil branch list
Executing command (/mnt/projects/app-backend): fossil tag list
Executing command (/mnt/projects/app-backend): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json

Reading ./composer.lock (/mnt/projects/app-backend/composer.lock)
Reading /mnt/projects/app-backend/vendor/composer/installed.json
Reading /root/.composer/cache/repo/https---repo.packagist.org/packages.json from cache
Downloading https://repo.packagist.org/packages.json if modified
[304] https://repo.packagist.org/packages.json
Reading /root/.composer/cache/repo/https---repo.packagist.org/provider-webman~event.json from cache
Downloading https://repo.packagist.org/p2/webman/event.json if modified
[304] https://repo.packagist.org/p2/webman/event.json
Reading /root/.composer/cache/repo/https---repo.packagist.org/provider-webman~event.json from cache
Reading /root/.composer/cache/repo/https---repo.packagist.org/provider-webman~event~dev.json from cache
Downloading https://repo.packagist.org/p2/webman/event~dev.json if modified
[304] https://repo.packagist.org/p2/webman/event~dev.json
./composer.json has been updated
Reading ./composer.json (/mnt/projects/app-backend/composer.json)
Loading config file ./composer.json (/mnt/projects/app-backend/composer.json)
Executing command (/mnt/projects/app-backend): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/mnt/projects/app-backend): git describe --exact-match --tags
Executing command (/mnt/projects/app-backend): git log --pretty="%H" -n1 HEAD
Executing command (/mnt/projects/app-backend): hg branch
Executing command (/mnt/projects/app-backend): fossil branch list
Executing command (/mnt/projects/app-backend): fossil tag list
Executing command (/mnt/projects/app-backend): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /root/.composer/composer.json

Reading ./composer.lock (/mnt/projects/app-backend/composer.lock)
Reading /mnt/projects/app-backend/vendor/composer/installed.json
Running composer update webman/event
Loading composer repositories with package information
Reading /root/.composer/cache/repo/https---repo.packagist.org/packages.json from cache
Downloading https://repo.packagist.org/packages.json if modified
[304] https://repo.packagist.org/packages.json
Reading /root/.composer/cache/repo/https---repo.packagist.org/provider-webman~event.json from cache
Downloading https://repo.packagist.org/p2/webman/event.json if modified
[304] https://repo.packagist.org/p2/webman/event.json
Built pool.
Running pool optimizer.
Pool optimizer completed in 0.002 seconds
Found 125 package versions referenced in your dependency graph. 2 (2%) were optimized away.
Updating dependencies
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.001 seconds
Analyzed 123 packages to resolve dependencies
Analyzed 247 rules to resolve dependencies
Lock file operations: 1 install, 0 updates, 0 removals
Installs: webman/event:v1.0.4
  - Locking webman/event (v1.0.4)
Writing lock file
Installing dependencies from lock file (including require-dev)
Reading ./composer.lock (/mnt/projects/app-backend/composer.lock)
Package operations: 1 install, 0 updates, 0 removals
Installs: webman/event:v1.0.4
Reading /root/.composer/cache/files/webman/event/35361357841cbdc2eac451a3c4c0d4f8c8929024.zip from cache
  - Loading webman/event (v1.0.4) from cache
  - Installing webman/event (v1.0.4): Extracting archive
Executing async command (CWD): '/usr/bin/unzip' -qq '/mnt/projects/app-backend/vendor/composer/tmp-a0cc89870cbe879ecfaf1eef018f5866' -d '/mnt/projects/app-backend/vendor/composer/47784e6d'
Executing async command (CWD): rm -rf '/mnt/projects/app-backend/vendor/composer/47784e6d'
> post-package-install: support\Plugin::install
Script support\Plugin::install handling the post-package-install event terminated with an exception
Downloading https://packagist.org/downloads/
[201] https://packagist.org/downloads/

In ClassLoader.php line 582:

  [ErrorException]                                                                                                          
  include(/mnt/projects/app-backend/vendor/webman/event/src/Install.php): failed to open stream: No such file or directory  

Exception trace:
  at phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:582
 Composer\Util\ErrorHandler::handle() at phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:582
 include() at phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:582
 Composer\Autoload\{closure}() at phar:///usr/local/bin/composer/vendor/composer/ClassLoader.php:433
 Composer\Autoload\ClassLoader->loadClass() at n/a:n/a
 spl_autoload_call() at n/a:n/a
 defined() at /mnt/projects/app-backend/vendor/workerman/webman-framework/src/support/Plugin.php:23
 support\Plugin::install() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:439
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:257
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:148
 Composer\EventDispatcher\EventDispatcher->dispatchPackageEvent() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:396
 Composer\Installer\InstallationManager::Composer\Installer\{closure}() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:411
 Composer\Installer\InstallationManager->executeBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:319
 Composer\Installer\InstallationManager->downloadAndExecuteBatch() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:218
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:797
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:622
 Composer\Installer->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Installer.php:287
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/RequireCommand.php:490
 Composer\Command\RequireCommand->doUpdate() at phar:///usr/local/bin/composer/src/Composer/Command/RequireCommand.php:339
 Composer\Command\RequireCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:378
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:141
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:88
 require() at /usr/local/bin/composer:29

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] [<packages>...]

环境: php:7.4.27 webman:1.5.6 composer:2.5.7

composer.json

{
  "name": "workerman/webman",
  "type": "project",
  "keywords": [
    "high performance",
    "http service"
  ],
  "homepage": "https://www.workerman.net",
  "license": "MIT",
  "description": "High performance HTTP Service Framework.",
  "authors": [
    {
      "name": "walkor",
      "email": "walkor@workerman.net",
      "homepage": "https://www.workerman.net",
      "role": "Developer"
    }
  ],
  "support": {
    "email": "walkor@workerman.net",
    "issues": "https://github.com/walkor/webman/issues",
    "forum": "https://wenda.workerman.net/",
    "wiki": "https://workerman.net/doc/webman",
    "source": "https://github.com/walkor/webman"
  },
  "require": {
    "php": ">=7.2",
    "workerman/webman-framework": "^1.5.0",
    "monolog/monolog": "^2.0",
    "vlucas/phpdotenv": "^5.5",
    "webman/console": "^1.2",
    "illuminate/filesystem": "^8.83",
    "illuminate/database": "^8.83",
    "illuminate/pagination": "^8.83",
    "illuminate/events": "^8.83",
    "midi/work-wechat": "^1.1",
    "workerman/validation": "^3.0",
    "tinywan/exception-handler": "^1.1",
    "webman/think-cache": "^1.0",
    "psr/container": "^1.1.1",
    "php-di/php-di": "^6",
    "doctrine/annotations": "^1.14",
    "webman/event": "*"
  },
  "suggest": {
    "ext-event": "For better performance. "
  },
  "autoload": {
    "psr-4": {
      "": "./",
      "app\\": "./app",
      "App\\": "./app",
      "app\\View\\Components\\": "./app/view/components"
    },
    "files": [
      "./support/helpers.php"
    ]
  },
  "scripts": {
    "post-package-install": [
      "support\\Plugin::install"
    ],
    "post-package-update": [
      "support\\Plugin::install"
    ],
    "pre-package-uninstall": [
      "support\\Plugin::uninstall"
    ]
  }
}

虽然会报错,但是依赖的确加载进来了,但是没有运行依赖的安装流程,导致没有生成event.php配置文件,不止这个扩展,很多其他扩展都有这样的问题,也许是我的环境原因,但是我排查了很久依旧没有什么头绪,Walkor大大可以帮忙给一点点头绪吗?万分感谢~

walkor commented 1 year ago

我没有环境定位不到。 你不如升级composer试下。 这里是webman主项目,不应该发 webman/event 相关的issue

winson-young commented 1 year ago

不好意思,主要是很多依赖都有这个问题,所以就发到这里了,我的composer已经是最新的2.5.7了,刚才也尝试了2.5.8,也是一样的错误,不过还是感谢walkor大佬,我15年就使用过大佬的workerman,感谢walkor大佬的开源精神。