composer require barryvdh/laravel-cors

    C:\web\whmall>composer require barryvdh/laravel-cors    
    ./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
        - Can only install one of: asm89/stack-cors[1.3.0, 1.2.0].
        - Can only install one of: asm89/stack-cors[1.3.0, 1.2.0].
        - Can only install one of: asm89/stack-cors[1.3.0, 1.2.0].
        - barryvdh/laravel-cors v1.0.6 requires asm89/stack-cors ^1.3 -> satisfiable by asm89/stack-cors[1.3.0].
        - Installation request for barryvdh/laravel-cors v1.0.6 -> satisfiable by barryvdh/laravel-cors[v1.0.6].
        - Installation request for asm89/stack-cors (locked at 1.2.0) -> satisfiable by asm89/stack-cors[1.2.0].
    Installation failed, reverting ./composer.json to its original content.

仔细查说明:https://packagist.org/packages/barryvdh/laravel-cors

需要环境:37.png

而我的composer.lock里的 asm89/stack-cors 版本是1.2,所以需要升级

composer require asm89/stack-cors 1.3.0

    C:\web\whmall>composer require asm89/stack-cors 1.3.0    
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Package operations: 0 installs, 1 update, 0 removals
      - Updating asm89/stack-cors (1.2.0 => 1.3.0): Downloading (100%)
    Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
    Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
    Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead.
    Writing lock file
    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover --ansi
    Discovered Package: barryvdh/laravel-cors
    Discovered Package: beyondcode/laravel-dump-server
    Discovered Package: fideloper/proxy
    Discovered Package: intervention/image
    Discovered Package: laravel/passport
    Discovered Package: laravel/tinker
    Discovered Package: maatwebsite/excel
    Discovered Package: mews/captcha
    Discovered Package: nesbot/carbon
    Discovered Package: nunomaduro/collision
    Discovered Package: overtrue/laravel-wechat
    Discovered Package: simplesoftwareio/simple-qrcode
    Discovered Package: spatie/laravel-permission
    Discovered Package: yansongda/laravel-pay
    Package manifest generated successfully.
    C:\web\whmall>

再安装composer require barryvdh/laravel-cors v1.0.6

    C:\web\whmall>composer require barryvdh/laravel-cors v1.0.6    
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Package operations: 0 installs, 1 update, 0 removals
      - Updating barryvdh/laravel-cors (v0.11.4 => v1.0.6): Downloading (100%)
    Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
    Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
    Package zendframework/zend-diactoros is abandoned, you should avoid using it. Use laminas/laminas-diactoros instead.
    Writing lock file
    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover --ansi
    Discovered Package: barryvdh/laravel-cors
    Discovered Package: beyondcode/laravel-dump-server
    Discovered Package: fideloper/proxy
    Discovered Package: intervention/image
    Discovered Package: laravel/passport
    Discovered Package: laravel/tinker
    Discovered Package: maatwebsite/excel
    Discovered Package: mews/captcha
    Discovered Package: nesbot/carbon
    Discovered Package: nunomaduro/collision
    Discovered Package: overtrue/laravel-wechat
    Discovered Package: simplesoftwareio/simple-qrcode
    Discovered Package: spatie/laravel-permission
    Discovered Package: yansongda/laravel-pay
    Package manifest generated successfully.
    C:\web\whmall>