When executing the command composer update –ignore-platform-reqs, an error is reported: script @php artisan package:discover –ansi handling the Post-autoload-dump event returned with error code 255
1. When executing the command composer update –ignore-platform-reqs, an error is reported: script @php artisan package:discover –ansi handling the Post-autoload-dump event returned with error code 255. as shown in Figure 1
PS e:\wwwroot\larabbs> composer update --ignore-platform-reqs Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (inclusion require-dev) Nothing to install, update or remove Package SwiftMailer/SwiftMailer is bandoned, you should avoid using it. Use symfony/mailer instead. GENERATING OPTIMIZED AUTOLOAD FILES > Illuminate\Foundation\ComposerScripts::PostAutoLoadDump > @php artisan package:discover --ansi PHP parse error: syntax error, unexpected|, Expecting Variable (t_variable) in E:\wwwroot\larabbs\vendor\psr\log\src\loggerinterface.php on line 30 PHP fatal error: exception thrown on line 0 PHP parse error: syntax error, unexpected|, Expecting Variable (t_variable) in E:\wwwroot\larabbs\vendor\psr\log\src\loggerinterface.php on line 30 PHP fatal error: exception thrown on line 0 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255 PS e:\wwwroot\larabbs>
2. Why the option –ignore-platform-reqs is added when executing the composer update command. The reason is that when executing composer update, an error is reported: it is missing from your system. install or enable phps pcntl extension.. as shown in Figure 2
PS E:\wwwroot\larabbs> composer update Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages. problem 1 - Laravel/Horizon[v5.6.0, ..., 5.x-dev]require ext-pcntl * -> it is missing from your system. install or enable phpS PCNTL extension. - root composer.json require laravel/horizon ~5.6 -> satisfiable by laravel/horizon[v5.6.0, ..., 5.x-dev]. To enable extensions, verify that they are enabled in your .ini files: - C:\PHP-7.4.27\php.ini You can also run `php --ini` inside terminal to see which files are used by php in CLI mode. PS e:\wwwroot\larabbs>
3. When installing Laravel/Horizon based on Composer, an error is reported: Package Laravel/Horizon at version ~5.6 has requirements incompatible with your php version, php extensions and composer version. The command was executed before: composer require “laravel/horizon:~5.6” –ignore-platform-reqs . I finally decided to uninstall Laravel/Horizon.
4. Edit composer.json, delete the line: “Laravel/Horizon”: “~5.6”, and execute the command again: composer update. Error: classHorizonnot found. as shown in Figure 3
PS E:\wwwroot\larabbs> composer update
Loading composer repositories with package information
Updating dependencies
lock file operations: 0 installs, 9 updates, 1 removal
- Removing Laravel/Horizon (v5.7.18)
- Downgrading PSR/log (2.0.0 => 1.1.4)
- downgrading symfony/css-selector (v6.0.2 => v5.4.2)
- downgrading symfony/deprecation-contracts (v3.0.0 => v2.5.0)
- Downgrading symfony/event-dispatcher (v6.0.2 => v5.4.0)
- downgrading symfony/event-dispatcher-contracts (v3.0.0 => v2.5.0)
- Upgrading symfony/service-contracts (v2.4.1 => v2.5.0)
- downgrading symfony/string (v6.0.2 => v5.4.2)
- Downgrading symfony/translation (v6.0.2 => v5.4.2)
- Downgrading symfony/translation-contracts (v3.0.0 => v2.5.0)
Writing lock file
Installing dependencies from lock file (inclusion require-dev)
Package operations: 0 installs, 9 updates, 1 remove
- Removing Laravel/Horizon (v5.7.18)
- Downgrading symfony/deprecation-contracts (v3.0.0 => v2.5.0): Extracting Archive
- Downgrading PSR/log (2.0.0 => 1.1.4): Extracting Archive
- Downgrading Symfony/CSS-Selector (v6.0.2 => v5.4.2): Extracting Archive
- Downgrading symfony/event-dispatcher-contracts (v3.0.0 => v2.5.0): Extracting Archive
- Downgrading symfony/event-dispatcher (v6.0.2 => v5.4.0): Extracting Archive
- Downgrading symfony/string (v6.0.2 => v5.4.2): Extracting Archive
- Upgrading symfony/service-contracts (v2.4.1 => v2.5.0): Extracting Archive
- Downgrading symfony/translation-contracts (v3.0.0 => v2.5.0): Extracting Archive
- Downgrading symfony/translation (v6.0.2 => v5.4.2): Extracting Archive
Package SwiftMailer/SwiftMailer is bandoned, you should avoid using it. Use symfony/mailer instead.
GENERATING OPTIMIZED AUTOLOAD FILES
> Illuminate\Foundation\ComposerScripts::PostAutoLoadDump
> @php artisan package:discover --ansi
Error
classHorizonNot found
at e:\wwwroot\larabbs\app\providers\authserviceprovider.php:36
32▕ // Dynamically return the policy name corresponding to the model, such as: //app\model\user=>app\policies\userpolicy,
33▕ Returnapp\policies\\.class_basename($modelclass).policy;
34▕ });
35▕
➜ 36▕ \horizon::auth(function ($request) {
37▕ // Is it a webmaster?
38▕ return \auth::user()->hasRole(Founder);
39▕ });
40▕ }
1 E:\wwwroot\larabbs\vendor\laravel\framework\src\illuminate\container\boundmethod.php:36
App\Providers\AuthServiceProvider::boot()
2 E:\wwwroot\larabbs\vendor\laravel\framework\src\illuminate\container\util.php:40
ILUMINATE\Container\BoundMethod::Illuminate\Container\{Closure}()
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
PS e:\wwwroot\larabbs>
5. Manually delete the configuration file config/horizon.php and page resource files such as css and js stored in the public/vendor/horizon folder. Delete the file app/providers/horizonserviceprovider.php. Edit the file and remove Horizon related code.
6. When the command composer update is executed again, an error is no longer reported. Learning the lesson, –ignore-platform-reqs is absolutely not usable. as shown in Figure 4
PS E:\wwwroot\larabbs> composer update Loading composer repositories with package information Updating dependencies Nothing to modify in lock file Installing dependencies from lock file (inclusion require-dev) Nothing to install, update or remove Package SwiftMailer/SwiftMailer is bandoned, you should avoid using it. Use symfony/mailer instead. GENERATING OPTIMIZED AUTOLOAD FILES > Illuminate\Foundation\ComposerScripts::PostAutoLoadDump > @php artisan package:discover --ansi Discovered Package: BarryVDH/Laravel-DebugBar Discovered Package: Facade/Ignition Discovered Package: Fruitcake/Laravel-Cors Discovered package: intervention/image Discovered Package: Laravel/Sail Discovered Package: Laravel/Sanctum Discovered Package: Laravel/Tinker Discovered Package: Laravel/UI Discovered Package: Mews/Captcha Discovered package: mews/purifier Discovered Package: Nesbot/Carbon Discovered Package: NUNOMADURO/COLLISION Discovered Package: OverTrue/Laravel-Lang Discovered Package: Spatie/Laravel-Permission Discovered Package: SummerBlue/Administrator Discovered Package: SummerBlue/Generator Discovered Package: SummerBlue/Laravel-Active Package manifested successfully. 84 packages you are using are looking for funding. Use the `Composer Fund` command to find out more! > @php artisan vendor:publish --tag=laravel-assets --ansi --force No Publishable Resources for Tag[laravel-assets]. publishing complete. PS e:\wwwroot\larabbs>



