Laravel 5.2 - bootstrap/cache/services.php 丢失

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38208263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:26:55  来源:igfitidea点击:

Laravel 5.2 - bootstrap/cache/services.php missing

laravellaravel-5laravel-5.2

提问by Keith Yeoh

After I ran composer update/ install then when I run php artisan cache:clear. I got the following error.

在我运行 composer update/install 之后,当我运行 php artisan cache:clear 时。我收到以下错误。

[ErrorException] file_put_contents({application-root-path}/bootstrap/cache/services.php): failed to open stream: No such file or directory

[ErrorException] file_put_contents({application-root-path}/bootstrap/cache/services.php):无法打开流:没有那个文件或目录

Is there any command able to re-cache the file? As for now no matter what php artisan function that I run also will caught into the same error.

是否有任何命令能够重新缓存文件?至于现在无论我运行什么 php artisan 函数也会陷入同样的​​错误。

p/s: Please comment below if you need me to provide any further information for debug use.

p/s:如果您需要我提供任何进一步的信息以供调试使用,请在下面发表评论。

回答by Paul Androschuk

make sure to run this command:

确保运行此命令:

sudo chmod 777 -R bootstrap/cache

回答by grondon

Just type:

只需输入:

cd bootstrap/
mkdir cache
cd .. 
composer install

回答by Ganesh Kandu

run this command

运行这个命令

php artisan optimize --force

it will create services.phpand compiled.php

它将创建services.php和已编译的.php

回答by fatemeh sadeghi

I solved this problem this way: If there is a cache directory, delete it and recreate it

我是这样解决这个问题的:如果有缓存目录,删除它并重新创建它