无法创建缓存目录.. 或目录不可写.在 Laravel 中进行无缓存

2022-01-21 00:00:00 php laravel composer-php

我创建了一个新的 Laravel 项目.当我去终端安装依赖时 composer 显示以下警告:

I created a new Laravel project. When I go to the terminal to install the dependecies composer displays the following warning:

无法创建缓存目录/home/w3cert/.composer/cache/repo/https---packagist.org/,或者目录不可写.继续进行而不使用缓存.

推荐答案

更改文件夹的组权限

sudo chown -R w3cert /home/w3cert/.composer/cache/repo/https---packagist.org

还有 Files 文件夹

and the Files folder too

sudo chown -R w3cert /home/w3cert/.composer/cache/files/

我假设 w3cert 是您的用户名,如果没有将第 4 个参数更改为您的用户名.

I'm assuming w3cert is your username, if not change the 4th parameter to your username.

如果问题仍然存在,请尝试

If the problem still persists try

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

现在,您可能无法创建应用目录,如果发生这种情况,请对您的 html 文件夹或您尝试在其中创建 laravel 项目的文件夹执行相同操作.

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.

相关文章