barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.17k stars 1.16k forks source link

There are no commands defined in the "ide-helper" namespace. #1249

Closed simplenotezy closed 2 years ago

simplenotezy commented 3 years ago

Versions:

Question:

I am getting this error:

There are no commands defined in the "ide-helper" namespace.

I have tried following the installation guide here. https://github.com/barryvdh/laravel-ide-helper#adding-additional-facades

Also VSCode complains about this:

Undefined method 'userFromToken'.intelephense(1013)

image

But the code works just fine.

I am not sure what I am missing here

Similar issues: https://github.com/barryvdh/laravel-ide-helper/issues/829

mfn commented 3 years ago

Does the information in https://github.com/barryvdh/laravel-ide-helper/pull/438 help?

lucassusanto commented 3 years ago

There are no commands defined in the "ide-helper" namespace.

I also ran into this problem. I forgot to reset the APP_ENV variable in the .env file from production to local. I use the following code in AppServiceProvider.php instead of bootstrap/app.php as stated in here.

public function register()
{
    if ($this->app->isLocal()) {
        $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
    }
}
stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

mhmmdtech commented 1 year ago

I faced this error in the deployment process of my project. My post-autoload-dump is like this:

"post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan ide-helper:generate",
            "@php artisan ide-helper:models --nowrite",
            "@php artisan package:discover --ansi"
        ],

As soon as I run the composer install --optimize-autoloader --no-dev in production, I faced this error.

spacemudd commented 1 year ago

@mhmmdtech Use "dev-post-update-cmd" like this:

        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate"
        ],
        "dev-post-update-cmd": [
            "@php artisan ide-helper:generate",
            "@php artisan ide-helper:meta"
        ]
pishguy commented 9 months ago

Did you added this line to app/config?

Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,