-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Description
Laravel Version
12.41.1
PHP Version
8.4.15
Database Driver & Version
MySQL (8.4.2)
Description
I'm currently running into the same issue that was previously reported here:
#56098
(opened on 22 Jun)
Even though that issue is closed, the problem still exists in the latest Laravel release.
When running composer install or composer update, package discovery fails with:
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Error
Call to a member function make() on null
at vendor\laravel\framework\src\Illuminate\Console\Command.php:171
167▕ */
168▕ #[\Override]
169▕ public function run(InputInterface $input, OutputInterface $output): int
170▕ {
➜ 171▕ $this->output = $output instanceof OutputStyle ? $output : $this->laravel->make(
172▕ OutputStyle::class, ['input' => $input, 'output' => $output]
173▕ );
This makes Composer commands unusable because artisan package:discover crashes.
What I tried:
composer dump-autoload
php artisan clear-compiled
deleting bootstrap/cache/packages.php & services.php
reinstalling vendor folder
checking for broken service providers
as in previous issue it states:
If I put $this->laravel = app(); into the Command's constructor manually then run composer update again then it works well, but I can't do that on deploy or live environment.
it works but do i need to use it still
Please reopen the previous issue or provide a fix.
Currently, any project hitting this state cannot run Composer updates at all.
Steps To Reproduce
composer install
composer update
During post-autoload-dump, Laravel runs:
@php artisan package:discover --ansi
The command fails with:
Error: Call to a member function make() on null
The process stops and Composer cannot complete the install/update.