Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
651 views
in Technique[技术] by (71.8m points)

symfony - Error "could not delete" with Composer on Vagrant

I have a Vagrant running Linux and I'm trying to install Symfony.

After the command composer create-project symfony/framework-standard-edition ./ "2.5.*" I have the error :

[RuntimeException]
  Could not delete ./.git/objects/pack/tmp_idx_llwUKb:

If I try to composer update another project, I always have this kind of error Could not delete

Any ideas?

Edit: For a simple sudo composer update -vvv on another project:

  - Installing sonata-project/admin-bundle (dev-master 8a022aa)
Failed to download sonata-project/admin-bundle from source: Could not delete /vagrant/crm_neo/vendor/sonata-project/admin-bundle/.git/objects/pack/tmp_idx_hchQhc:
Now trying to download from dist
  - Installing sonata-project/admin-bundle (dev-master 8a022aa)

Failed: [RuntimeException] Could not delete /vagrant/crm_neo/vendor/sonata-project/admin-bundle/.git/objects/pack/tmp_idx_hchQhc:



  [RuntimeException]
  Could not delete /vagrant/crm_neo/vendor/sonata-project/admin-bundle/.git/o
  bjects/pack/tmp_idx_hchQhc:



Exception trace:
 () at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:193
 ComposerUtilFilesystem->unlink() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:151
 ComposerUtilFilesystem->removeDirectoryPhp() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:129
 ComposerUtilFilesystem->removeDirectory() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:35
 ComposerUtilFilesystem->remove() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:80
 ComposerUtilFilesystem->emptyDirectory() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:108
 ComposerDownloaderFileDownloader->doDownload() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:89
 ComposerDownloaderFileDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Downloader/ArchiveDownloader.php:35
 ComposerDownloaderArchiveDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:201
 ComposerDownloaderDownloadManager->download() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:156
 ComposerInstallerLibraryInstaller->installCode() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:87
 ComposerInstallerLibraryInstaller->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:152
 ComposerInstallerInstallationManager->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:139
 ComposerInstallerInstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:548
 ComposerInstaller->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:217
 ComposerInstaller->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:128
 ComposerCommandUpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
 SymfonyComponentConsoleCommandCommand->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:889
 SymfonyComponentConsoleApplication->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:193
 SymfonyComponentConsoleApplication->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:135
 ComposerConsoleApplication->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:124
 SymfonyComponentConsoleApplication->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:84
 ComposerConsoleApplication->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:15
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It happened once to me and it turns out that I was hitting composer's timeout.

You could take the following measures to gain some speed:

  1. Increase composer process-timeout (default 300) (not really needed if the following settings will help you gain speed, but can't hurt)
  2. Set dist as preferred install type.
  3. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...