13

after the installation of jetstream via composer composer require laravel/jetstream then suddenly get an ErrorException that there's no such file or directory.

Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   ErrorException

  require(F:\laravelApps\test_proj\vendor\laravel\jetstream\src/../routes/.php): failed to open stream: No such file or directory

  at F:\laravelApps\test_proj\vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.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\test_proj\vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.php:144
      require()

  2   F:\laravelApps\test_proj\vendor\laravel\jetstream\src\JetstreamServiceProvider.php:172
      Illuminate\Support\ServiceProvider::loadRoutesFrom("F:\laravelApps\test_proj\vendor\laravel\jetstream\src/../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.

I use this guideline for the installation. https://jetstream.laravel.com/1.x/installation.html

I tried to delete the vendor and run composer update doesn't work tried to cache clear but still doesn't work.

VLDCNDN
  • 692
  • 1
  • 7
  • 19

4 Answers4

37

Uncache your routes and try again.


  1. Remove jetstream from composer

    composer remove laravel/jetstream
    
  2. Then you should be able to cache your routes using

     php artisan route:cache
    
  3. Then install jetstream

     composer require laravel/jetstream
    
muhive
  • 1,879
  • 14
  • 20
1

UPDATE:

You just need to run php artisan route:cache

https://github.com/laravel/jetstream/issues/186

VLDCNDN
  • 692
  • 1
  • 7
  • 19
0

You can't run route:cache if your cached setup refers to things you don't have, so it won't run, failing with exactly this error, however, it's just a cache so you can delete it, so I did:

rm bootstrap/cache/config.php
php artisan route:cache

That allowed me to recover from this error without having to reinstall packages in production in a way that might touch composer.lock.

Synchro
  • 35,538
  • 15
  • 81
  • 104
0

whenever you will get this situation in any installation first check the error details , if you found any error that relate to your installation then its good or you just need to clear the cache so it will fix definitely.

In your case first clear the cache as below answers

php artisan config:cache
php artisan cache:clear
happymacarts
  • 2,547
  • 1
  • 25
  • 33