在localhost上运行Symfony2上的composer更新时出现运行时异常

时间:2014-05-17 00:39:17

标签: symfony composer-php

我在使用composer更新依赖项时遇到运行时异常。这是跟踪:

Exception trace:
 () at phar:///usr/bin/composer.phar/src/Composer/Downloader/GitDownloader.php:158
 Composer\Downloader\GitDownloader->cleanChanges() at phar:///usr/bin/composer.phar/src/Composer/Downloader/VcsDownloader.php:89
 Composer\Downloader\VcsDownloader->update() at phar:///usr/bin/composer.phar/src/Composer/Downloader/DownloadManager.php:255
 Composer\Downloader\DownloadManager->update() at phar:///usr/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:176
 Composer\Installer\LibraryInstaller->updateCode() at phar:///usr/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:105
 Composer\Installer\LibraryInstaller->update() at phar:///usr/bin/composer.phar/src/Composer/Installer/InstallationManager.php:173
 Composer\Installer\InstallationManager->update() at phar:///usr/bin/composer.phar/src/Composer/Installer/InstallationManager.php:140
 Composer\Installer\InstallationManager->execute() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:529
 Composer\Installer->doInstall() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:215
 Composer\Installer->run() at phar:///usr/bin/composer.phar/src/Composer/Command/UpdateCommand.php:123
 Composer\Command\UpdateCommand->execute() at phar:///usr/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:892
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar:///usr/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:121
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar:///usr/bin/composer.phar/bin/composer:43
 require() at /usr/bin/composer.phar:15

我还不清楚这是怎么回事!现在我甚至无法在我的应用程序中添加供应商包:(

当我回答n时,我问我是否要放弃对修改过的文件进行更改时,我做对了..

Updating sensio/distribution-bundle (v2.2.6 => 2.2.x-dev 2779c8b)
    The package has modified files:
--- somes files...

1 个答案:

答案 0 :(得分:0)

我经常收到此错误。以下是另一个包的示例:

enter image description here

您可以输入$git diff来查看作曲家正在谈论的变化。

如果您未对sensio/distribution-bundle进行任何更改,只需输入 y 并按输入即可。 (作曲家会问“你想放弃这些改变吗?”

这是因为作曲家可以看到sensio/distribution-bundle中有一些修改。

有两种情况:

1 您确实对供应商文件进行了一些更改,在本例中为sensio/distribution-bundle。你永远不应该这样做...如果你想这样做,只需在这种情况下分叉sensio/distribution-bundle并将其添加到你的composer.json文件中:

"repositories": [
      {
        "type": "vcs",
        "url": "git@github.com:YourUsername/SensioDistributionBundle.git"
      },
    ],
"require": {
        //...
        "sensio/distribution-bundle":"dev-master",
        //...
      },
//...

2 您尚未进行任何更改。

您已对供应商文件进行了一些更改,在本例中为sensio/distribution-bundle。 In也可能发生,具体取决于您使用的IDE或OS。在这种情况下,始终回答YES。如果这些文件是由IDE或OS创建的,只需将它们添加到.gitignore文件中:

# PHP Storm generated files #
.idea
# OS generated files #
*.DS_Store