19

I try to add repository from github (designmodo/Flat-UI), play with config and get errors No valid composer.json was found in any branch or..., Your requirements could not be resolved to an installable set of packages., The requested package designmodo/flat-ui could not be found in any version

What mistake I made in config:

"repositories": {
   "flat-ui": {
     "type": "package",
     "package": {
       "name": "designmodo/Flat-UI", 
       "version": "1.3.0", // Don't know is it important? Where get this number in repo?
       "source": {
         "url": "https://github.com/designmodo/Flat-UI",
         "type": "git",
         "reference": "dev-master" // reference is branch name? 
       }
     }
   }
 },

 "require": {
   "twbs/bootstrap-sass": "~3.2",
   "designmodo/Flat-UI": "dev-master" // branch again (/minimum-stability?)
 },

At some point composer download package but return error (i don't know when he did it, I lookup in vendor folder and designmodo folder was be there).

3 Answers 3

24

Problem solved. Play around and changed reference to master and version to any * in "designmodo/Flat-UI": "*" section. After that composer download package via git and update composer.lock without problems. Should work for any github repos.

Working config:

{
    "repositories": {
      "flat-ui": {
        "type": "package",
        "package": {
          "name": "designmodo/Flat-UI",
          "version": "1.3.0",
          "source": {
            "url": "https://github.com/designmodo/Flat-UI",
            "type": "git",
            "reference": "master"
          }
        }
      }
    },
    "require": {
        "twbs/bootstrap-sass": "~3.2",
        "designmodo/Flat-UI": "*"
    },
}

https://getcomposer.org/doc/05-repositories.md

Sign up to request clarification or add additional context in comments.

1 Comment

This helped me a lot. This may be obvious, but name needs to have "a vendor name, a forward slash, and a package name" (according to a deprecation warning generated by Composer). version needs to be a valid version string (like 1.0.0), though it can be arbitrary.
9

It only worked for me removing the label, like this:

{
        "repositories":[
        {              
            "type": "package",
            "package": {
              "name": "designmodo/Flat-UI",
              "version": "1.3.0",
              "source": {
                "url": "https://github.com/designmodo/Flat-UI",
                "type": "git",
                "reference": "master"
              }
            }
        }
        ],
        "require": {
            "twbs/bootstrap-sass": "~3.2",
            "designmodo/Flat-UI": "*"
        }, 
}

Comments

0

I had a similar problem: Beside adding a Git repository, I also wanted to include a SVN repository (that has no composer.json) and a ZIP file. The solution above did not work for me.

With Composer (version 1) I got following error message:

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

Upgrading to Composer version 2 helped, since the error message was much more helpful:

Problem 1 - Root composer.json requires XXX *, found XXX[master] but it does not match your minimum-stability.

So the solution is to add "@dev" behind the required version. Furthermore, I had to include "secure-http": false to the config section, because the ZIP file comes from a page that has no HTTPS.

Here is my full composer.json file:

{
    "prefer-dist": true,
    "repositories": {
            "viathinksoft/vnag": {
                    "type": "package",
                    "packagist.org": false,
                    "package": {
                            "name": "viathinksoft/vnag",
                            "version": "master",
                            "license": "Apache-2.0",
                            "source": {
                                    "url": "https://svn.viathinksoft.com/svn/vnag/",
                                    "type": "svn",
                                    "reference": "trunk/"
                            }
                    }
            },
            "dcodeio/bcrypt.js": {
                    "type": "package",
                    "packagist.org": false,
                    "package": {
                            "name": "dcodeio/bcrypt.js",
                            "version": "master",
                            "license": [
                                    "BSD-3-Clause",
                                    "MIT"
                            ],
                            "source": {
                                    "url": "https://github.com/dcodeio/bcrypt.js",
                                    "type": "git",
                                    "reference": "master"
                            }
                    }
            },
            "spamspan/spamspan": {
                    "type": "package",
                    "packagist.org": false,
                    "package": {
                            "name": "spamspan/spamspan",
                            "version": "master",
                            "license": "GPL-2.0-only",
                            "dist": {
                                    "url": "http://www.spamspan.com/releases/spamspan-latest.zip",
                                    "type": "zip",
                                    "reference": "master"
                            }
                    }
            }
    },
    "require": {
            "dcodeio/bcrypt.js": "*@dev",
            "viathinksoft/vnag": "*@dev",
            "spamspan/spamspan": "*@dev"
    },
    "config": {
            "secure-http": false,
            "preferred-install": {
                    "*": "dist"
            }
    }
}

I would also like to explain why I am doing this: These are examples of three third-party products which do not have composer.json file. I am aware that "bcrypt.io" is a npm project, and I could theoretically use npm to download it, and I could manually download and unpack the ZIP file in the postinstall part of composer. However, I would like to have all dependencies in the vendor directory of my project, but I don't want to manually add something in this directory, because it is managed by composer. So I let composer handle everything.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.