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

前端 未结 7 1770
粉色の甜心
粉色の甜心 2020-12-22 15:07

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

Cannot create cache

相关标签:
7条回答
  • 2020-12-22 15:32

    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/
    
    0 讨论(0)
  • 2020-12-22 15:32

    Use this command:

    sudo chown -R $USER ~/.composer/
    
    0 讨论(0)
  • 2020-12-22 15:34

    Run this command :

        sudo chown -R yourUser /home/yourUser/.composer
    
    0 讨论(0)
  • 2020-12-22 15:37

    Change the group permission for the folder

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

    and the Files folder too

    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.

    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.

    Hope this helps.

    0 讨论(0)
  • 2020-12-22 15:40

    I had a similar problem recently, and needed to change the permissions of my vendor folder

    By running following commands :

    1. php artisan cache:clear
    2. chmod -R 777 storage vendor
    3. composer dump-autoload

    I need to give all the permissions required to open and write vendor files to solve this issue

    0 讨论(0)
  • 2020-12-22 15:41

    When you installed composer pretty sure you used $ sudo command because of that the ~/.composer folder was created by the root.

    Run this to fix the issue:

    $ sudo chown -R $USER $HOME/.composer
    
    0 讨论(0)
提交回复
热议问题