php 无法创建缓存目录 .. 或目录不可写。在 Laravel 中不使用缓存继续
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35874482/
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
Cannot create cache directory .. or directory is not writable. Proceeding without cache in Laravel
提问by Karthik
I created a new Laravel project. When I go to the terminal to install the dependecies composer
displays the following warning:
我创建了一个新的 Laravel 项目。当我去终端安装依赖项时composer
显示以下警告:
Cannot create cache directory /home/w3cert/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache.
Cannot create cache directory /home/w3cert/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache.
回答by Jim M
When you installed composer pretty sure you used $ sudo
command because of that the ~/.composer
folder was created by the root.
当您安装 Composer 时,很确定您使用了$ sudo
命令,因为该~/.composer
文件夹是由根创建的。
Run this to fix the issue:
运行此命令以解决问题:
$ sudo chown -R $USER $HOME/.composer
回答by Nesar
Change the group permission for the folder
更改文件夹的组权限
sudo chown -R w3cert /home/w3cert/.composer/cache/repo/https---packagist.org
and the Files folder too
还有 Files 文件夹
sudo chown -R w3cert /home/w3cert/.composer/cache/files/
I'm assuming w3cert is your username, if not change the 4th parameter to your username.
我假设 w3cert 是您的用户名,如果没有将第 4 个参数更改为您的用户名。
If the problem still persists try
如果问题仍然存在,请尝试
sudo chown -R w3cert /home/w3cert/.composer
Now, there is a chance that you won't be able to create your app directory, if that happens do the same for your html folder or the folder you are trying to create your laravel project in.
现在,您可能无法创建您的应用程序目录,如果发生这种情况,请对您的 html 文件夹或您尝试在其中创建 Laravel 项目的文件夹执行相同的操作。
Hope this helps.
希望这可以帮助。
回答by Karthik
I had the same problem today. Try it!
我今天遇到了同样的问题。尝试一下!
sudo chown -R [yourgroup] /home/[youruser]/.composer/cache/repo/https---packagist.org/
sudo chown -R [yourgroup] /home/[youruser]/.composer/cache/files/
回答by Shrikant Pardhi
回答by RKAISSI Youssef
Run this command :
运行此命令:
sudo chown -R yourUser /home/yourUser/.composer
回答by Oppa
Use this command:
使用这个命令:
sudo chown -R $USER ~/.composer/