Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Rage6's avatar
Level 1

Failing Auth::routes() in Heroku, in spite of laravel/ui installations

I have been struggling to get my new Laravel project to work in Heroku, even though a past project had worked fine. I solved the usual problems, like the missing Procfile, and have attached the necessary database and app ENV variables. However, the homepage keeps giving me the same error: "In order to use the Auth::routes() method, please install the laravel/ui package." This error does not occur on my local host.

I've searched online all day for a solution, and all of them (to include posts here) point in the same direction: install laravel/ui with the command "composer require laravel/ui". But it never works, even though a) the installation seems to happen and b) the laravel/ui is found in both composer.json and /vendor. Each time, I push my changes to GitHub, and then I manually deploy to Heroku from GitHub.

To ensure that laravel/ui was actually getting to Heroku, I temporarily allowed /vendor to be push to GitHub too by removing it from the .gitignore list.

In short, I'm dumbfounded and searching for any hints about why this doesn't work. Finally, this may be the result of my recent upgrades to Laravel 9 or PHP 8, but who knows.

0 likes
8 replies
Sinnbeck's avatar

Can you try running composer dump-autoload on heroku?

Rage6's avatar
Level 1

@Sinnbeck I'm not sure how to do something like that directly to Heroku. I've tried "heroku composer require laravel/ui", but it gave me an error.

Rage6's avatar
Level 1

@martinbean Here you go

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
        "php": "^8.0.2",
        "doctrine/dbal": "^3.3",
        "guzzlehttp/guzzle": "^7.2",
        "laravel/framework": "^9.11",
        "laravel/sanctum": "^2.14.1",
        "laravel/tinker": "^2.7",
        "laravel/ui": "^3.4"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9.1",
        "laravel/sail": "^1.0.1",
        "mockery/mockery": "^1.4.4",
        "nunomaduro/collision": "^6.1",
        "phpunit/phpunit": "^9.5.10",
        "spatie/laravel-ignition": "^1.0"
    },
    "autoload": {
        "psr-4": {
            "App\": "app/",
            "Database\Factories\": "database/factories/",
            "Database\Seeders\": "database/seeders/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-update-cmd": [
            "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ],
        "post-install-cmd": [
          "php artisan clear-compiled",
          "chmod -R 777 public/"
        ]
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

You can see the actual error here.

Rage6's avatar
Rage6
OP
Best Answer
Level 1

Okay, I may have solved the problem. Earlier in my research, I had referenced this StackOverflow ticket and added the below suggestion to the "script" in composer.json:

"post-install-cmd": [
     "php artisan clear-compiled",
     "chmod -R 777 public/"
 ]

Once I removed that code, the server let me through. It looks butt ugly at the moment because an error is telling me that the Bootstrap isn't there, but at least it's working in some way.

Sinnbeck's avatar

@Rage6 Your assets are laoded via http and therefor does not show up (css and js)

Rage6's avatar
Level 1

It's all solved now. Thanks everyone!

Please or to participate in this conversation.