php artisan register:app fails: "There are no commands defined in the "register" namespace"
Registering a private app as described in the Heimdall-Apps wiki no longer works. The command exists in app/Console/Commands/RegisterApp.php, but artisan does not know it.
Steps to reproduce
- Put a private app folder, e.g.
MyApp, intoSupportedApps. - Run:
docker exec -it heimdall php /app/www/artisan register:app MyApp
Expected behaviour
Application Added - MyApp - <appid>
Actual behaviour
ERROR There are no commands defined in the "register" namespace.php artisan list does not show register:app either.
Cause
Since the move to the new Laravel application structure, bootstrap/app.php only passes the console routes file to withRouting():
->withRouting(
...
commands: __DIR__.'/../routes/console.php',
...
)withRouting() then calls withCommands([routes/console.php]). Because that array is not empty, ApplicationBuilder::withCommands() does not add its default path app/Console/Commands. As a result, RegisterApp is never discovered.
Suggested fix
Register the commands directory explicitly in bootstrap/app.php, for example:
->withCommands([
__DIR__.'/../app/Console/Commands',
])Workaround
Until this is fixed, the command can be registered and run manually:
docker exec -i heimdall sh -c 'cat > /tmp/register.php' <<'PHP'
<?php
require '/app/www/vendor/autoload.php';
$app = require '/app/www/bootstrap/app.php';
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
$kernel->bootstrap();
$kernel->registerCommand($app->make(App\Console\Commands\RegisterApp::class));
$kernel->call('register:app', ['folder' => 'MyApp']);
echo $kernel->output();
PHP
docker exec -it -u abc heimdall php /tmp/register.phpEnvironment
- Heimdall version: 2.8.3
- Installation: linuxserver/heimdall Docker image on Unraid
Source: linuxserver/Heimdall