php手工艺品库后的Ardisan错误SQLSTATE [42S02]:找不到基本表或查看:
我用Jetstream进行了一个Laravel项目,并将其上传到Github。在我和同事尝试执行Composer install
之后,我们收到了以下错误:
> 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
我们在composer.json
中的脚本没有脚本再次尝试,但是每一个之后工匠命令我们尝试,我们会得到以下例外:
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
当我们尝试执行PHP Artisan迁移
时,这也会发生这种情况,该命令应解决此错误。
那么,我们现在可以尝试什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您通过运行每个“ PHP Artisan”命令来遇到此错误,则可以在引导过程中查询数据库,并且由于空数据库,因此此错误会不断投掷。您可能需要检查所有已查询用户数据库的地方(也许在提供商中)
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)