Composer install 报错
项目构建命令:
composer install --no-dev --no-interaction -o --ignore-platform-reqs
构建输出:没有错误,陷入死循环
> Illuminate\Foundation\ComposerScripts::postAutoloadDump> @php artisan package:discover --ansiDiscovered Package: elfsundae/laravel-hashidDiscovered Package: fideloper/proxyDiscovered Package: fruitcake/laravel-corsDiscovered Package: intervention/imageDiscovered Package: laravel/tinkerDiscovered Package: maatwebsite/excelDiscovered Package: milon/barcodeDiscovered Package: nesbot/carbonDiscovered Package: overtrue/laravel-wechatDiscovered Package: sentry/sentry-laravelDiscovered Package: shallowman/laralogDiscovered Package: tymon/jwt-authPackage manifest generated successfully.69 packages you are using are looking for funding.Use the `composer fund` command to find out more!Loading composer repositories with package informationWarning: Accessing gitlab.zz-med-stg.com over http which is an insecure protocol. Updating dependenciesLock file operations: 0 installs, 3 updates, 0 removals - Downgrading symfony/http-client (v6.2.6 => v5.4.20) - Downgrading symfony/http-client-contracts (v3.1.1 => v2.5.2) - Upgrading symfony/http-kernel (v4.4.13 => v4.4.50)Writing lock fileInstalling dependencies from lock filePackage operations: 0 installs, 3 updates, 0 removals - Downgrading symfony/http-client-contracts (v3.1.1 => v2.5.2): Extracting archive - Upgrading symfony/http-kernel (v4.4.13 => v4.4.50): Extracting archive - Downgrading symfony/http-client (v6.2.6 => v5.4.20): Extracting archive101 package suggestions were added by new dependencies, use `composer suggest` to see details.Package overtrue/wechat is abandoned, you should avoid using it. Use w7corp/easywechat instead.Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.Package php-cs-fixer/diff is abandoned, you should avoid using it. No replacement was suggested.Generating optimized autoload filesClass App\Services\Data\Department\DataBoardRoomIdService located in ./app/Services/Data/Department/DataBoardRoomidService.php does not comply with psr-4 autoloading standard. Skipping.> Illuminate\Foundation\ComposerScripts::postAutoloadDump> @php artisan package:discover --ansiDiscovered Package: elfsundae/laravel-hashidDiscovered Package: fideloper/proxyDiscovered Package: fruitcake/laravel-corsDiscovered Package: intervention/imageDiscovered Package: laravel/tinkerDiscovered Package: maatwebsite/excelDiscovered Package: milon/barcodeDiscovered Package: nesbot/carbonDiscovered Package: overtrue/laravel-wechatDiscovered Package: sentry/sentry-laravelDiscovered Package: shallowman/laralogDiscovered Package: tymon/jwt-authPackage manifest generated successfully.69 packages you are using are looking for funding.Use the `composer fund` command to find out more!Loading composer repositories with package informationWarning: Accessing gitlab.zz-med-stg.com over http which is an insecure protocol. Updating dependenciesLock file operations: 0 installs, 3 updates, 0 removals - Upgrading symfony/http-client (v5.4.20 => v6.2.6) - Upgrading symfony/http-client-contracts (v2.5.2 => v3.1.1) - Downgrading symfony/http-kernel (v4.4.50 => v4.4.13)Writing lock fileInstalling dependencies from lock filePackage operations: 0 installs, 3 updates, 0 removals - Downgrading symfony/http-kernel (v4.4.50 => v4.4.13): Extracting archive - Upgrading symfony/http-client-contracts (v2.5.2 => v3.1.1): Extracting archive - Upgrading symfony/http-client (v5.4.20 => v6.2.6): Extracting archive101 package suggestions were added by new dependencies, use `composer suggest` to see details.Package overtrue/wechat is abandoned, you should avoid using it. Use w7corp/easywechat instead.Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.Package php-cs-fixer/diff is abandoned, you should avoid using it. No replacement was suggested.Generating optimized autoload filesClass App\Services\Data\Department\DataBoardRoomIdService located in ./app/Services/Data/Department/DataBoardRoomidService.php does not comply with psr-4 autoloading standard. Skipping.> Illuminate\Foundation\ComposerScripts::postAutoloadDump> @php artisan package:discover --ansiDiscovered Package: elfsundae/laravel-hashidDiscovered Package: fideloper/proxyDiscovered Package: fruitcake/laravel-corsDiscovered Package: intervention/imageDiscovered Package: laravel/tinkerDiscovered Package: maatwebsite/excelDiscovered Package: milon/barcodeDiscovered Package: nesbot/carbonDiscovered Package: overtrue/laravel-wechatDiscovered Package: sentry/sentry-laravelDiscovered Package: shallowman/laralogDiscovered Package: tymon/jwt-authPackage manifest generated successfully.69 packages you are using are looking for funding.Use the `composer fund` command to find out more!Loading composer repositories with package informationWarning: Accessing gitlab.zz-med-stg.com over http which is an insecure protocol.
解决办法:
1、 升级composer版本
由composer v2.0.8升至 v2.5.2
composer self-update --stable
升级了版本之后,
报错1:
In PluginManager.php line 738: php-http/discovery contains a Composer plugin which is blocked by your allo w-plugins config. You may add it to the list if you consider it safe. You can run "composer config --no-plugins allow-plugins.php-http/discovery [true|false]" to enable it (true) or disable it explicitly and suppress thi s exception (false) See https://getcomposer.org/allow-plugins install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]ERROR: Job failed: command terminated with exit code 1
报错2:
In PluginManager.php line 738: easywechat-composer/easywechat-composer contains a Composer plugin which is blocked by your allow-plugins config. You may add it to the list if you co nsider it safe. You can run "composer config --no-plugins allow-plugins.easywechat-composer /easywechat-composer [true|false]" to enable it (true) or disable it explic itly and suppress this exception (false) See https://getcomposer.org/allow-plugins install [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--download-only] [--dev] [--no-suggest] [--no-dev] [--no-autoloader] [--no-progress] [--no-install] [--audit] [--audit-format AUDIT-FORMAT] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--] [<packages>...]ERROR: Job failed: command terminated with exit code 1
2、升级后报错解决:
根据报错,在composer.json文件中添加对应插件
"config": { "allow-plugins": { "php-http/discovery": false, "easywechat-composer/easywechat-composer": false } },
来源地址:https://blog.csdn.net/weixin_45112997/article/details/128974831