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

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

Cannot create cache directory .. or directory is not writable. Proceeding without cache in Laravel

phplaravelcomposer-php

提问by Karthik

I created a new Laravel project. When I go to the terminal to install the dependecies composerdisplays 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 $ sudocommand because of that the ~/.composerfolder 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

Give full access of .composer to user.

向用户授予 .composer 的完全访问权限。

sudo chown -R 'user-name' /home/'user-name'/.composer

or

或者

sudo chmod 777 -R /home/'user-name'/.composer

user-nameis your system user-name.

user-name是您的系统用户名。

to get user-name type "whoami" in terminal:

在终端中获取用户名类型“whoami”:

enter image description here

在此处输入图片说明

回答by RKAISSI Youssef

Run this command :

运行此命令:

    sudo chown -R yourUser /home/yourUser/.composer

回答by Oppa

Use this command:

使用这个命令:

sudo chown -R $USER ~/.composer/