简体   繁体   English

无法在 laravel 8 上安装 laravel/jetstream

[英]Failed to install laravel/jetstream on laravel 8

after the installation of jetstream via composer composer require laravel/jetstream then suddenly get an ErrorException that there's no such file or directory.在通过 composer composer require laravel/jetstream安装composer require laravel/jetstream之后,突然得到一个 ErrorException ,说没有这样的文件或目录。

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 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.我试图删除供应商并运行composer update不起作用试图清除缓存但仍然不起作用。

Uncache your routes and try again.取消缓存您的路线并重试。


  1. Remove jetstream from composer从作曲家中删除 jetstream

     composer remove laravel/jetstream
  2. Then you should be able to cache your routes using然后你应该能够使用缓存你的路线

     php artisan route:cache
  3. Then install jetstream然后安装jetstream

     composer require laravel/jetstream

UPDATE:更新:

You just need to run php artisan route:cache你只需要运行php artisan route:cache

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

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:你不能运行route:cache如果你的缓存设置指的是你没有的东西,所以它不会运行,因为这个错误而失败,但是,它只是一个缓存,所以你可以删除它,所以我做了:

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 .这使我能够从这个错误中恢复,而不必以可能会触及composer.lock的方式在生产中重新安装软件包。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM