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

nasirkhan's avatar

Base table or view not found: 1146 Table doesn't exist

I followed this tutorial and started to build an application ( https://github.com/nasirkhan/laravel-5-starter-application ). but the problem is when i try to create a new instance from this project it shows an error and could not complete the installation. i run composer install and the error was following,

[Illuminate\Database\QueryException]                                                                                                        
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel-5-starter.permissions' doesn't exist (SQL: select * from `permissions`)  
                                                                                                                                              

                                                                                                           
  [PDOException]                                                                                           
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel-5-starter.permissions' doesn't exist  
                                                                                                           

Script php artisan clear-compiled handling the post-install-cmd event returned with an error

                      
  [RuntimeException]  
  Error Output:
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
0 likes
7 replies
nasirkhan's avatar

thanks for the prompt reply. I tried that too and got the same error. my main question is why am i getting an error on the very first composer install command.

zachleigh's avatar
Level 47

It may be because of the way you registered the AuthServiceProvider. Try changing out the getPermissions method with this one:

    protected function getPermissions()
    {
        try {
            return Permission::with('roles')->get();
        } catch (\Exception $e) {
            return [];
        }
    }
13 likes
stereoscience's avatar

@zachleigh Thank you so much for that answer! I knew what the problem was but I just couldn't think of a solution. Your solution works great.

1 like

Please or to participate in this conversation.