laravelcomposer-phplaravel-forge

Composer install cannot delete files


I am attempting to run a composer install to update dependencies on my production server, but I continue to get the following error (this happens to be on a Laravel Forge deployed server).

Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 0 installs, 0 updates, 24 removals
  - Removing symfony/dom-crawler (v3.2.1)

[RuntimeException]
Could not delete /home/forge/website.com/vendor/symfony/dom-crawler/composer.json:

Why is this happening? Can I manually delete the entire vendor folder on the forge server and redeploy all the dependencies without harming it?


Solution

  • It might be a permission problem. Maybe at some point you used sudo and the files now are owned by root. If you usually use another user for this operation and now use that one again, the files of course cannot be removed.

    So try

    ls -l /home/forge/website.com/vendor/symfony/dom-crawler/composer.json
    

    to see which user/group owns the file. Also check the permissions of that directory; maybe it is not writeable anymore?