php composer.phar 更新失败 - 包名称中的拼写错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15799810/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 09:59:45  来源:igfitidea点击:

php composer.phar update failed - A typo in the package name

phpcomposer-phpsymfony-2.2

提问by freedev

I have created a new Symfony 2.1 project and added a custom package downloaded by a SVN repo. Now I'm tryng to upgrade the project to Symfony 2.2, but anytime I try to execute the command php ~/bin/composer.phar updatethe following error message appears:

我创建了一个新的 Symfony 2.1 项目并添加了一个由 SVN 存储库下载的自定义包。现在我正在尝试将项目升级到 Symfony 2.2,但是每当我尝试执行该命令时php ~/bin/composer.phar update,都会出现以下错误消息:

Loading composer repositories with package information
Updating dependencies (including require-dev)         
Your requirements could not be resolved to an installable set of packages.

  Problem 1
  - The requested package custom/utils could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

This is Symfony 2.2 composer.json:

这是 Symfony 2.2 composer.json

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "svn+ssh://sources.de.ext/usr/local/svnroot/utils"
        }
    ],
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.2.*",
        "doctrine/orm": "~2.2,>=2.2.3",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.2.*",
        "symfony/monolog-bundle": "2.2.*",
        "sensio/distribution-bundle": "2.2.*",
        "sensio/framework-extra-bundle": "2.2.*",
        "sensio/generator-bundle": "2.2.*",
        "jms/security-extra-bundle": "1.4.*",
        "jms/di-extra-bundle": "1.3.*",
        "custom/utils": "*"
    },
    "scripts": {
        "post-install-cmd": [
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets",
            "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "alpha",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.2-dev"
        }
    }
}

Custom utils have following composer.json:

自定义实用程序具有以下内容composer.json

{
    "name": "custom/utils",
    "version": "1.0.0",
    "description": "The Custom Libraries",
    "autoload": {
        "psr-0": { 
            "Blogo": "src/",
            "WideImage": "lib/"
        }
    },
    "require": {
        "symfony/console": "2.*",
        "symfony/yaml": "2.*"
    }
}

Could anyone help me to understand what's wrong in new 2.2 Symfony? Because this error message appear only Symfony 2.2 upgrade.

任何人都可以帮助我了解新的 2.2 Symfony 有什么问题吗?因为这个错误信息只有在 Symfony 2.2 升级时才会出现。

采纳答案by Seldaek

Try running composer update --verboseor composer show custom/utils --verbose. Both will show you some output about the loading of your SVN repository. It should indicate which versions are loaded or not.

尝试运行composer update --verbosecomposer show custom/utils --verbose. 两者都会向您显示有关加载 SVN 存储库的一些输出。它应该指出哪些版本已加载或未加载。

My guess is that you have a dev-trunkversion available, and if you require it it will most likely work. You should not specify version: 1.0.0in your composer.json, because composer reads the version information from tags/branches in your VCS.

我的猜测是您有一个dev-trunk可用的版本,如果您需要它,它很可能会起作用。您不应version: 1.0.0在 composer.json 中指定,因为 composer 从 VCS 中的标签/分支读取版本信息。