php artisan register:app fails: "There are no commands defined in the "register" namespace"
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start with bootstrap/app.php and app/Console/Commands/RegisterApp.php, then reproduce the failure with the documented docker exec artisan register:app MyApp command. Verify that artisan list exposes register:app and that running it produces the expected Application Added output for a private app.
Written by the indexing model from the issue text.
Description
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.php
Environment
- Heimdall version: 2.8.3
- Installation: linuxserver/heimdall Docker image on Unraid
- Dominant language
- PHP
- Stars
- 9.3k
- Forks
- 629
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from linuxserver/Heimdall
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
linuxserver/Heimdall#1601 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
linuxserver/Heimdall#1596 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
linuxserver/Heimdall#1588 · 3 comments ·
All issues in linuxserver/Heimdall
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·