douhuifen9942
2014-04-27 21:49
浏览 111
已采纳

为什么Composer安装不同的包?

I've been working with the Magento Firegento custom Composer installer, and I ran into this odd bit of Composer behavior I don't understand.

Consider the following dead simple composer.json file

{
    "require": {
        "magento-hackathon/magento-composer-installer": "*"
    }
}

If I run compser.phar install with this composer.json file, I get the following.

$ composer.phar install --no-dev 
Loading composer repositories with package information
Installing dependencies
  - Installing aoepeople/composer-installers (v0.0.1)
    Loading from cache

Writing lock file
Generating autoload files

From my mostly lay-person's understanding composer.phar, I've said

Hey, composer, please install the magento-hackathon/magento-composer-installer package from packagist.org

And composer has said back to me

Sir, yes sir! Here's the aoepeople/composer-installers package

I don't understand why composer installed aoepeople/composer-installers, when I asked for magento-hackathon/magento-composer-installer.

To be clear: I understand the reason magento-hackathon/magento-composer-installer wasn't installed is this is a package that lives in a different composer repository. My original mistake was not including this repository in my composer.json file.

However, it doesn't make sense to me that composer would install a different package than the one I asked for. When I search packagist there's no magento-hackathon/magento-composer-installer extension.

Why does packagist install a different extension? What's happening behind the scenes to make magento-hackathon/magento-composer-installer resolve to aoepeople/composer-installers? How/where in the composer source could I debug this sort of thing myself in the future?

图片转代码服务由CSDN问答提供 功能建议

我一直在使用Magento Firegento自定义Composer安装程序,我遇到了这个奇怪的Composer行为我 不明白。

考虑以下死的简单 composer.json 文件

  {
“ 要求“:{
”magento-hackathon / magento-composer-installer“:”*“
} 
} 
   
 
 

如果我运行 使用此 composer.json 文件进行compser.phar安装,我得到以下内容。

  $ composer.phar install --no-dev 
使用包信息加载编写器存储库
安装依赖项
  - 安装aoepeople / composer-installers(v0.0.1)
 从缓存中加载
 
写入锁定文件
生成自动加载文件
   
 
 

从我大多数人的理解 composer.phar ,我' 我说

嘿,作曲家,请从packagist.org安装 magento-hackathon / magento-composer-installer

作曲家回复我说了

先生,是的,先生! 这是 aoepeople / composer-installers

我不明白为什么作曲家安装 aoepeople / composer-installers ,当我要求 magento-hackathon / magento-composer-installer

要明确:我理解 magento-hackathon /的原因 未安装magento-composer-installer 这是一个包含在不同作曲家存储库。 我最初的错误是不在我的 composer.json 文件中包含此存储库。

但是,这对我来说没有意义 那个作曲家会安装一个不同于我要求的包。 当我搜索包时,没有 magento-hackathon / magento-composer -installer 扩展名

为什么packagist会安装不同的扩展程序? 幕后发生了什么使 magento-hackathon / magento-composer-installer 解析为 aoepeople / composer-installers ? 我将来如何/在作曲家来源中调试这种事情?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

  • dongnuo4594 2014-04-27 22:18
    最佳回答

    Vinai published a great writeup on Magento and Composer here.

    Quoting from there

    Composer will use packagist.org to look where to get the libraries. Because Magento modules aren’t listed there, you will have to add the packages.firegento.org repository to the configuration as follows [...]

    So you will need the repository

       "repositories":[
         {
           "type":"composer",
           "url":"http://packages.firegento.com"
         }
       ],
    

    to get the magento composer installer.

    And yes composer offers replacements. On the packaging entry for aoepeople/composer-installers you will notice the replaces section:

    Package Screenshot

    And since magento-hackathon/magento-composer-installer is not available on packagist composer will deliver you aoepeople/composer-installers.

    评论
    解决 无用
    打赏 举报
查看更多回答(2条)

相关推荐 更多相似问题