无法在laravel 8上安装laravel/jetstream

2022-03-26 00:00:00 php laravel laravel-8

通过Composer安装JetStream后composer require laravel/jetstream 然后突然出现ErrorException,表示没有这样的文件或目录。

Writing lock file
Generating optimized autoload files
> IlluminateFoundationComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   ErrorException

  require(F:laravelApps	est_projvendorlaraveljetstreamsrc/../routes/.php): failed to open stream: No such file or directory

  at F:laravelApps	est_projvendorlaravelframeworksrcIlluminateSupportServiceProvider.php:144
    140▕      */
    141▕     protected function loadRoutesFrom($path)
    142▕     {
    143▕         if (! ($this->app instanceof CachesRoutes && $this->app->routesAreCached())) {
  ➜ 144▕             require $path;
    145▕         }
    146▕     }
    147▕
    148▕     /**

  1   F:laravelApps	est_projvendorlaravelframeworksrcIlluminateSupportServiceProvider.php:144
      require()

  2   F:laravelApps	est_projvendorlaraveljetstreamsrcJetstreamServiceProvider.php:172
      IlluminateSupportServiceProvider::loadRoutesFrom("F:laravelApps	est_projvendorlaraveljetstreamsrc/../routes/.php")
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

我使用此指导原则进行安装。 https://jetstream.laravel.com/1.x/installation.html

我尝试删除供应商,但运行composer update不起作用 已尝试清除缓存,但仍不起作用。


解决方案

取消缓存您的路由,然后重试。


  1. 从Composer中删除Jetstream

    composer remove laravel/jetstream
    
  2. 那么您应该能够使用

    缓存您的路由
     php artisan route:cache
    
  3. 然后安装JetStream

     composer require laravel/jetstream
    

相关文章