沃梦达 / 编程问答 / php问题 / 正文

无法获得作曲家“路径"存储库工作

Can#39;t get composer quot;pathquot; repository to work(无法获得作曲家“路径存储库工作)

本文介绍了无法获得作曲家“路径"存储库工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的目录结构:

I have a directory structure like so:

composer.json < Main
  packages/
    balunker/
      testpackage/
        composer.json < Package
        src/
          TestPackage.php

主要的composer.json如下所示:

{
    "name": "vagrant/composer-test",
    "repositories": [
        {
             "type": "path",
            "url": "packages/*/*"
        }
    ],
    "require": {
        "balunker/testpackage": "*"
    }
}

虽然包 composer.json 看起来像这样:

While the package composer.json looks like so:

{
  "name": "balunker/testpackage",
  "autoload": {
    "psr-4": {
      "Balunker\": "src/"
    }
  }
}

composer update 上,我简单地收到一条消息,指出无法解析包.没有创建符号链接,也没有安装包.我确实花了半天时间来解决这个问题,但没有任何成功.

On composer update I simple get a message that the package could not be resolved. No symlinks are created and no package is installed. I have literally spent half of my day figuring this out, without any success.

我还上传了 composer update -vvv 的详细输出:http://pastebin.com/mMRHsACk.

I also uploaded a composer update -vvv verbose output of this: http://pastebin.com/mMRHsACk.

我的作曲家版本是最新的(截至 2016 年 4 月 20 日下午 2:39 UTC),所有这些都在 Vagrant (Debian) 中运行.

My composer version is the latest (as of 20th of April 2016 at 2:39pm UTC) and all of this is running inside Vagrant (Debian).

非常感谢您提供的任何建议.我真的不知道还能做什么.

ANY recommendation from hereon is greatly appreciated. I really don't know what else to do any more.

推荐答案

我也在 Github 上发布了这个问题,结果发现文档有点误导.它说:

I posted the issue on Github as well and it turns out that the documentation is a little misleading. It says:

{
    "repositories": [
        {
            "type": "path",
            "url": "../../packages/my-package"
        }
    ],
    "require": {
        "my/package": "*"
    }
}

但是,如果您只有一个没有发布的本地 repo,您​​必须使用:

However, if you just have a local repo without releases, you have to use:

{
    "repositories": [
        {
            "type": "path",
            "url": "../../packages/my-package"
        }
    ],
    "require": {
        "my/package": "dev-master"
    }
}

版本 dev-master 是这里的关键(假设您在 master 分支上工作).这有点令人恼火,但感谢一些乐于助人的作曲家贡献者,我终于可以掌握这一点.

The version dev-master is the key here (given that you are working on the master branch). This was mildly infuriating, but thanks to some helpful composer contributors, I could finally get a grip on this.

我希望这对将来的人有所帮助.

I hope this may help somebody in the future.

祝你好运!

这篇关于无法获得作曲家“路径"存储库工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法获得作曲家“路径"存储库工作

基础教程推荐