关于插件市场插件安装问题

864328615

问题描述

插件在第一次安装时一切都是正常的,但是卸载composer包的时候会报错,插件所产生的配置文件也不会被删除干净(有时会,有时不会,暂且认为不会),具体的操作步骤及报错信息如下:

  • composer remove webman/think-cache
./composer.json has been updated
Using version ^1.0 for webman/think-cache
./composer.json has been updated
Running composer update webman/think-cache
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 0 updates, 0 removals
  - Locking opis/closure (3.6.3)
  - Locking topthink/think-cache (v2.0.6)
  - Locking topthink/think-container (v2.0.3)
  - Locking webman/think-cache (v1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
> support\Plugin::uninstall
Script support\Plugin::uninstall handling the pre-package-uninstall event terminated with an exception

  [ErrorException]                                                                                                                                                         
  require(/Users/webman-v1.2.5/vendor/composer/../symfony/deprecation-contracts/function.php): Failed to open stream: No such file or direct  
  ory                                                                                                                                                                      

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--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>]...

之后对这个插件重装产生如下问题

  • composer require webman/think-cache
Using version ^1.0 for webman/think-cache
./composer.json has been updated
Running composer update webman/think-cache
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 0 updates, 0 removals
  - Locking opis/closure (3.6.3)
  - Locking topthink/think-cache (v2.0.6)
  - Locking topthink/think-container (v2.0.3)
  - Locking webman/think-cache (v1.0.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
> support\Plugin::uninstall
Script support\Plugin::uninstall handling the pre-package-uninstall event terminated with an exception

  [ErrorException]                                                                                                                                                         
  require(/Users/webman-v1.2.5/vendor/composer/../symfony/deprecation-contracts/function.php): Failed to open stream: No such file or direct  
  ory                                                                                                                                                                      

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--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>]...

运行环境

  • webman版本:v1.2.5
  • 操作系统:macOS
  • Workerman版本:最新
  • PHP:8.0.16
2051 1 1
1个回答

walkor

修改 support/Plugin.php 里面 requireAutoloadFile 方法,改成这样试下

    protected static function requireAutoloadFile()
    {
        if (!is_file($autoload_file = __DIR__ . '/../vendor/autoload.php')) {
            return false;
        }
        require_once __DIR__ . '/../support/helpers.php';
        return true;
    }
  • 864328615 2022-03-09

    我刚看了 本来就是这样的

  • shixia 2022-03-10

    我也有这个问题,老大完全没法卸载

  • walkor 2022-03-10

    你看错了,有改动

年代过于久远,无法发表回答
🔝