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

trevorpan's avatar

package:discover --ansi handling the post-autoload-dump event returned with error code 1

Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Any ideas of what is happening in envoyer on deploy?

I checked the logs - there's nothing related to this...

0 likes
6 replies
trevorpan's avatar

I take that back. There is a log related. I didn't think the time matched earlier. Tried a new deploy and got this:

production.ERROR: Class 'Laravel\Telescope\TelescopeApplicationServiceProvider' not found {"exception":"[object] (Error(code: 0):

Telescope is only in the "require-dev" section of composer.json. It doesn't make sense that it's being called in the package:discover script on deploy....

Is this the correct use?

    "extra": {
        "laravel": {
            "dont-discover": [
                "TelescopeServiceProvider"
            ]
        }
    },
trevorpan's avatar
trevorpan
OP
Best Answer
Level 15

Well, I've made a lot of rookie mistakes.

Somehow telescope was added to production on an earlier commit. So, I added a gate to telescope and to production. Got past this error.

The gate feature is pretty slick so I guess I'll work with it. Does anyone else use this in production?

SimonAngatia's avatar

So what's the answer? I am having the same problem. But I can't understand your answer

My error is:

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

rhand's avatar

Having the same error now deploying. Already updated to composer 2 to deal with new OAuth key, but now on deployment I am having this error as well. No idea yet how to solve this and we do not use Telescope. When we did deploy deploy -vvv staging we did not get any useful errors and laravel.log also shows us nothing related to the deployment.

rhand's avatar

Hmm did get an error

[2021-10-08 04:59:37] staging.ERROR: Please provide a valid cache path. {"exception":"[object] (InvalidArgumentException(code: 0): Please provide a valid cache path. at /home/forge/staging.domain.com/releases/623/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php:36)
[stacktrace]

so may need to solve that first.

1 like

Please or to participate in this conversation.