Reputation: 517
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?
Upvotes: 7
Views: 23120
Reputation: 151
It is because of permission problem, Maybe you used sudo for composer update or composer install. Run:
sudo chown -R user:group projectfolder
or simply own the vendor folder
sudo chown -R user:group projectfolder/vendor
Upvotes: 3
Reputation: 4258
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?
Upvotes: 4
Reputation: 3237
The problem might be because composer is hitting its timeout. So you might be need increase the time out of composer.
You could take the following measures to gain some speed:
Enable https protocol for github, which is faster.
~/.composer/config.json
{
"config": {
"process-timeout": 600,
"preferred-install": "dist",
"github-protocols": ["https"]
}
}
If you still have problems after that, you can also clear composer's cache:
rm -rf ~/.composer/cache
Also you might try updating git.
Similar question is discussed Here in laracasts
Upvotes: 7