本文介绍了Composer - 添加没有 composer.json 的 git 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从 github (designmodo/Flat-UI) 添加存储库,使用配置并得到错误 No valid composer.json was found in any branch or ..., 你的无法将需求解析为一组可安装的软件包., 在任何版本中都找不到请求的软件包 designmodo/flat-ui

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?)
 },

在某些时候composer下载包但返回错误(我不知道他什么时候做的,我在供应商文件夹中查找并且designmodo文件夹在那里).

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).

推荐答案

问题解决了.在 "designmodo/Flat-UI": "*"部分.之后通过 git 下载作曲家包并更新 composer.lock 没有问题.应该适用于任何 github 存储库.

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.

工作配置:

{
    "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

这篇关于Composer - 添加没有 composer.json 的 git 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 09:01
查看更多