I made a Laravel project with Jetstream and uploaded it to Github. After my colleague and I tried to execute composer install, we received the following error:
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Illuminate\Database\QueryException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.users' doesn't exist (SQL: select * from `users` limit 1)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:742
738▕ // If an exception occurs when attempting to run a query, we'll format the error
739▕ // message to include the bindings with SQL, which will make this exception a
740▕ // lot more helpful to the developer instead of just the database's errors.
741▕ catch (Exception $e) {
➜ 742▕ throw new QueryException(
743▕ $query, $this->prepareBindings($bindings), $e
744▕ );
745▕ }
746▕ }
1 [internal]:0
Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\RouteServiceProvider))
+15 vendor frames
17 routes/web.php:20
Illuminate\Database\Eloquent\Model::__callStatic("first", [])
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
We tried again without the scripts in composer.json, went well, but after each and every artisan-command we try, we get the following exception:
In Connection.php line 742:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.users' doesn't exist (SQL: select * from `users` limit 1)
In Connection.php line 396:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'test.users' doesn't exist
This also happens when we try to execute php artisan migrate, the command which should solve this error.
So, what can we try now?
If you're getting this error by running every "php artisan" command, then you might query database during the bootstrapping process and because of the empty database, this error keeps throwing. you might need to check all places you have queried the database for users (maybe in providers)