How does a package is appeared in `firegento` without a `composer.json` in its github repository

magento.stackexchange https://magento.stackexchange.com//questions/29306

  •  11-12-2019
  •  | 
  •  

문제

Today I tried to install a magento extension/package through composer. I have a successfully set up composer in my root folder of magento. For the sake of understanding, I am providing you the folder structure

Folder Stucture

magento
|
 ---- composer.json
|
 ----composer.phar
|
 ----vendor
     |
      ---- autoload.php
     |
      ---- composer
     |
      ---- magento-hackathon

composer.json

{
    "require": {
        "magento-hackathon/magento-composer-installer": "1.*"
    },   
    "extra":{
        "magento-root-dir":"../magento",
        "magento-deploystrategy":"copy"           
    },  
    "repositories":[    
        {
            "packagist": false
        },        
        {
            "type":"composer",
            "url":"http://packages.firegento.com"
        }   
   ]   
}

As you can see, I am using repository magento-hackathon. This will allow me to use packages that are avialable in http://packages.firegento.com/ through my composer. I have searched a debugger package and I found out the right one for me. The package name is magento/debug. So I tried to install it via composer with this code

php composer.phar require --update-no-dev magento/debug

But it didn't work. It showed me an error. After that I have tried in lot ways to install this package. Some of them includes manual editing of my composer.json to include this package from github.

    {
        "type": "git",
        "url": "https://github.com/madalinoprea/magento-debug"
    } 

Then I tried to update my composer. Again it showed same error. Error looks like this.

Error Reported

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package magento/debug 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.

From error, I got a clue that, composer searching for composer.json file in the package and it couldn't find that package. I verified this by looking it in the github.

Then this question raised up in my mind

"How does a package is availble in firegento without possessing a composer file."

May be I am wrong in some point. If that is the case, please direct me to right path. Please help me guys

도움이 되었습니까?

해결책

I have used following code in my composer.json and it worked for me

{
    "require": {
        "magento-hackathon/magento-composer-installer": "dev-master",
        "magento/debug":"dev-master"
    },
     "extra": {
        "magento-root-dir": "../magento/",
        "magento-deploystrategy": "copy",
        "magento-force": "override"
    },
     "repositories": [
        {"type": "git", "url": "https://github.com/moleman/magento-debug"},
        {"type": "composer", "url": "http://packages.firegento.com"}
    ]
}

The main difference between the wrong composer.json file and this one are following

  1. I have added the required package in require field.

     "magento/debug" : "dev-master"
    

    -> Where dev-master indicates to branch that hold this package.(As of my understanding). This is specified in http://packages.firegento.com/#!/magento/debug also, under releases

    -> magento/debug is the name of the package that I need. This is also available in the above-specified link

  2. Specify from which repository I need to collect my package.

    I have specified the repository as like this

      {"type": "git", "url": "https://github.com/moleman/magento-debug"}
    

    It tells composer that magento/debug package needs the above GitHub repository in order to find that package(As per my understanding).

  3. I removed the code

    {
        "packagist": false
    }
    

This is because I notice that composer gives some constant errors due to the inclusion of this line. I added this line of code in order to avoid unwanted package downloading from packagist.com repository. In fact, it requires some packages from packagist.com in order to install my package. The above line of code resist packagist.com to do that. So the process of removing the above line downloaded the depended packages from packagist and thus allowed me to install the package successfully. I can see there are 4 extra packages inside vendor folder now. Some of them may be unwanted packages. But I am not sure about this point.

Again I am new using composer. So sometimes my understanding may wrong. But I strongly believe this points to give some hints to other people who may face the same problem in future. So it would be good to point out any "wrong statements" that I have done here :)

Thanks

다른 팁

The composer.json for this package is not missing, as firegento does not use the original github repository from madalinoprea, instead it uses https://github.com/moleman/magento-debug which you can see, if you click on a link of the releases on the http://packages.firegento.com/#!/magento/debug site which leads to https://api.github.com/repos/moleman/magento-debug/zipball/ebca981e6444f5062fe77b24440bbb285ba1a534

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top