0
votes

I can't seem to be able to complete installation of bundles using

composer require <bundle-name> because of these errors:

[Symfony\Component\Filesystem\Exception\IOException] Failed to remove directory "/var/www/emerson-suite/var/cache/de~/pools/rDfZ
I1q9aB": .

Complete console output of error:

Generating autoload files ocramius/package-versions: Generating version class... ocramius/package-versions: ...done generating version class

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

// Clearing the cache for the dev environment with debug // true

Symfony\Component\Filesystem\Exception\IOException] Failed to remove directory "/var/www/emerson-suite/var/cache/de~/pools/rDfZ
I1q9aB": .

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception

Installation failed, reverting ./composer.json to its original content.

[RuntimeException] An error occurred when executing the "'cache:clear --no-warmup'" command: // Clearing the cache for the dev environment with debug // true

[Symfony\Component\Filesystem\Exception\IOException] Failed to remove directory "/var/www/emerson-suite/var/cache/de~/pools/rDfZ I1q9aB": .

cache:clear [--no-warmup] [--no-optional-warmers] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]

Tried running composer with both sudo and without. The command that I ran is: $ sudo composer require javiereguiluz/easyadmin-bundle

Not sure what to do about this, any help is appreciated.

Update

My environment is Ubuntu on Vagrant VM on Mac OS X.

2
What if you remove the directory yourself? When I run into this kind of problems I perform rm -rf var/cache/* vendor/*.Stephan Vierkant
I know, I've seen a lot of people having a similar issue. I've tried removing the dirs myself, I've stopped all editor/ide but even with a clear folder, the composer install process creates de~ folder in cache dir, so I don't know why that is...Victor S
I have used the instructions on this blog to create a work-around, during installation of new bundles, and then I revert to my previous settings, this is not ideal, am I'm still looking for a permanent solution, but it lets me get the job done for now: beberlei.de/2013/08/19/speedup_symfony2_on_vagrant_boxes.htmlVictor S

2 Answers

1
votes

Seems like it could be an issue involving permissions inside the OS and perhaps development environments.

Try looking for the answer here, a lot of people seem to be having this issue. https://github.com/symfony/symfony/issues/19363#issuecomment-264655158

0
votes

The directory ./de~/ is the old /dev/ directory, as it has been moved ready to be deleted. The /pools/ directory is the cache that is being built during the run of the application. On the initial startup, it's using one user-account, but the webserver is running another, and so the original user account does not have permission to delete some files.

The easy way around this - in the dev environment at least - is to sudo rm -rf .../de~. When I do remove old versions of code on prod, I'll often have to do the same because there was more than just the original deploying user, writing to the cache directory.