如何在正确的路径中添加资产存储库?,在任何分支或标记中都找不到有效的json

时间:2017-10-14 10:58:10

标签: git composer-php composer.json

我想要资产存储库" assets.front"和" assets.admin"安装在路径" / httpdocs / assets / vendor"喜欢" Font-Awesome"而不是" / vendor"。

{
        "autoload": {
            "psr-4": {
                "App\\": "src/app"
            }
        },
        "repositories": [
            {
                "type": "package",
                "package": {
                    "name": "bower-asset/assets.front",
                    "version": "master",
                    "source": {
                        "url": "git@github.com:User/assets.front.git",
                        "type": "git",
                        "reference": "master"
                    }
                }
            },
            {
                "type": "package",
                "package": {
                    "name": "bower-asset/assets.admin",
                    "version": "master",
                    "source": {
                        "url": "git@github.com:User/assets.admin.git",
                        "type": "git",
                        "reference": "master"
                    }
                }
            }
        ],
        "config": {
            "vendor-dir": "vendor",
            "fxp-asset": {
                "installer-paths": 
                    {
                        "npm-asset-library": "httpdocs/assets/vendor",
                        "bower-asset-library": "httpdocs/assets/vendor"
                    }
            }
        },
        "require": {
            "fxp/composer-asset-plugin": "~1.3",
            "bower-asset/assets.front": "dev-master",
            "bower-asset/assets.admin": "dev-master",
            "bower-asset/Font-Awesome": "4.7.0"
        }
    }

我试过"额外",没有成功。

"extra": {
    "asset-installer-paths": {
      "npm-asset-library": "httpdocs/assets/vendor",
      "bower-asset-library": "httpdocs/assets/vendor"
    },
    "asset-repositories": [
      {
        "type": "bower-git",
        "url": "git@github.com:User/assets.front.git",
        "name": "bower-asset/assets.front.git"
      },
      {
        "type": "bower-git",
        "url": "git@github.com:User/assets.admin.git",
        "name": "bower-asset/assets.admin.git"
      }
    ]
  }

我有这个错误:

[Composer\Repository\InvalidRepositoryException]
  No valid bower.json was found in any branch or tag of git@github.com:User/assets.front.git, could not load a package from it.

和我的bower.json存在于root:

{
  "name": "assets.admin",
  "description": "Assets admin",
  "homepage": "",
  "moduleType": "globals",
  "ignore": [
    "/.*",
    "bower.json"
  ]
}

你有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我创建了" config.json"在文件夹"〜/ .composer"使用此代码:

{
"config": {
        "preferred-install": "dist",
        "github-protocols": ["https","http"],
        "github-oauth": {
            "github.com": "aa9a906cf406370b509bbce3a78829202b41b8e6"
        }
    }
}