When using Composer to upgrade from Yii 2.0.x, an error is reported:[ErrorException]Undefined variable: The analysis solution of nameMatchesRequiredPackage

使用 Composer 从 Yii 2.0.x 升级时,报错: [ErrorException] Undefined variable: nameMatchesRequiredPackage
1. When using Composer to upgrade from Yii 2.0.x, an error is reported:[ErrorException]undefined variable: nameMatchesRequiredPackage, as shown in Figure 1
使用 Composer 从 Yii 2.0.x 升级时,报错: [ErrorException] Undefined variable: nameMatchesRequiredPackage
Figure 1


PS E:\wwwroot\github-shuijingwan-yii2-app-advanced> composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/jquer
y.inputmask


  [ErrorException]
  Undefined variable: nameMatchesRequiredPackage


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoload
er] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose]
[-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable]
[--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...


2. Update 3 packages, first update the first 2, no errors are reported, and then update the third one, the error is reported, the search dependency package in the current project Bower-asset/jQuery.inputMask, does not exist, as shown in Figure 2
更新 3 个包,先更新前 2 个,未报错,再更新第 3 个,报错,在当前项目搜索依赖包 bower-asset/jquery.inputmask,不存在
Figure 2


PS E:\wwwroot\github-shuijingwan-yii2-app-advanced> composer update yiisoft/yii2 yiisoft/yii2-composer
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
PS E:\wwwroot\github-shuijingwan-yii2-app-advanced> composer update bower-asset/jquery.inputmask


  [ErrorException]
  Undefined variable: nameMatchesRequiredPackage


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-custom-installers] [--no-autoload
er] [--no-scripts] [--no-progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies] [-v|vv|vvv|--verbose]
[-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-stable]
[--prefer-lowest] [-i|--interactive] [--root-reqs] [--] [<packages>]...
PS E:\wwwroot\github-shuijingwan-yii2-app-advanced> composer search bower-asset/jquery.inputmask
bower-asset/jquery.inputmask
PS E:\wwwroot\github-shuijingwan-yii2-app-advanced> composer search yiisoft/yii2-composer
yiisoft/yii2-composer The composer plugin for Yii extension installer
yiisoft/yii2-composer The composer plugin for Yii extension installer


3. Check the file \vendor\yiisoft\yii2\composer.json, the bower-asset/jquery.inputMask has been changed to Bower-Asset/InputMask


    "require": {
        "php": ">=5.4.0",
        "ext-mbstring": "*",
        "ext-ctype": "*",
        "lib-pcre": "*",
        "yiisoft/yii2-composer": "~2.0.4",
        "ezyang/htmlpurifier": "~4.6",
        "cebe/markdown": "~1.0.0 | ~1.1.0",
        "bower-asset/jquery": "3.2.*@stable | 3.1.*@stable | 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable",
        "bower-asset/inputmask": "~3.2.2 | ~3.3.5",
        "bower-asset/punycode": "1.3.*",
        "bower-asset/yii2-pjax": "~2.0.1"
    },


4. In GitHub Check the submission log of this file, open the URL: https://github.com/yiisoft/yii2/commit/858e8015731 DA1AF978AF5E88EB495F3061FA120#DIFF-59858BCA2A40C010F385EAA7B6F5137F , as shown in Figure 3
在 Github 上查看此文件的提交日志
Figure 3
5. When using Composer to upgrade from Yii 2.0.x, adjust the command, the bower-asset/jquery.inputMask is changed to Bower-asset/inputMask, the update is successful, no errors are reported, as shown in Figure 4
使用 Composer 从 Yii 2.0.x 升级时,调整命令,bower-asset/jquery.inputmask 变更为 bower-asset/inputmask,更新成功,不再报错
Figure 4


PS E:\wwwroot\github-shuijingwan-yii2-app-advanced> composer update yiisoft/yii2 yiisoft/yii2-composer bower-asset/input
mask
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.