错误“无法删除"与 Vagrant 上的作曲家 [英] Error "could not delete" with Composer on Vagrant

查看:21
本文介绍了错误“无法删除"与 Vagrant 上的作曲家的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行 Linux 的 Vagrant,我正在尝试安装 Symfony.

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

在命令 composer create-project symfony/framework-standard-edition ./"2.5.*" 之后出现错误:

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:

如果我尝试 Composer 更新另一个项目,我总是有这种错误 Could not delete

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

有什么想法吗?

对于另一个项目上的简单 sudo composer update -vvv:

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
 Composer\Util\Filesystem->unlink() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:151
 Composer\Util\Filesystem->removeDirectoryPhp() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:129
 Composer\Util\Filesystem->removeDirectory() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:35
 Composer\Util\Filesystem->remove() at phar:///usr/local/bin/composer/src/Composer/Util/Filesystem.php:80
 Composer\Util\Filesystem->emptyDirectory() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:108
 Composer\Downloader\FileDownloader->doDownload() at phar:///usr/local/bin/composer/src/Composer/Downloader/FileDownloader.php:89
 Composer\Downloader\FileDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Downloader/ArchiveDownloader.php:35
 Composer\Downloader\ArchiveDownloader->download() at phar:///usr/local/bin/composer/src/Composer/Downloader/DownloadManager.php:201
 Composer\Downloader\DownloadManager->download() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:156
 Composer\Installer\LibraryInstaller->installCode() at phar:///usr/local/bin/composer/src/Composer/Installer/LibraryInstaller.php:87
 Composer\Installer\LibraryInstaller->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:152
 Composer\Installer\InstallationManager->install() at phar:///usr/local/bin/composer/src/Composer/Installer/InstallationManager.php:139
 Composer\Installer\InstallationManager->execute() at phar:///usr/local/bin/composer/src/Composer/Installer.php:548
 Composer\Installer->doInstall() at phar:///usr/local/bin/composer/src/Composer/Installer.php:217
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:128
 Composer\Command\UpdateCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:889
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:135
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:124
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:84
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:15

推荐答案

它发生在我身上一次,结果我遇到了作曲家的超时.

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. 增加 composer process-timeout(默认 300)(如果以下设置可以帮助您提高速度,则不需要)
  2. dist 设置为首选安装类型.
  3. 为github启用https协议,速度更快.
  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

~/.composer/config.json

{
    "config": {
        "process-timeout":      600,
        "preferred-install":    "dist",
        "github-protocols":     ["https"]
    }
}

如果之后还是有问题,也可以清除composer的缓存:

If you still have problems after that, you can also clear composer's cache:

rm -rf ~/.composer/cache

这篇关于错误“无法删除"与 Vagrant 上的作曲家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆