php手工艺品库后的Ardisan错误SQLSTATE [42S02]:找不到基本表或查看:

发布于 2025-01-31 13:20:04 字数 2106 浏览 5 评论 0原文

我用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

∞琼窗梦回ˉ 2025-02-07 13:20:04

如果您通过运行每个“ 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文