When using Composer to upgrade from Yii 2.0.x, an error is reported:[ErrorException]Undefined variable: The analysis solution of 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
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]#atfp_close_translate_span#[--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
PS e:\wwwroot\github-shuijingwan-yii2-app-advanced> composer update yiisoft/yii2 yiisoft/yii2-composer Loading composer repositories with package information Updating dependencies (included 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]#atfp_close_translate_span#[--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/htmlpuririfier": "~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
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
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 (included require-dev) Nothing to install or update GENERATING AUTOLOAD FILES
![使用 Composer 从 Yii 2.0.x 升级时,报错: [ErrorException] Undefined variable: nameMatchesRequiredPackage](http://www.shuijingwanwq.com/wp-content/uploads/2019/02/1.png)


