将软件包安装到自定义目录Composer中 [英] Install package into custom directory Composer

查看:135
本文介绍了将软件包安装到自定义目录Composer中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我正在尝试使用composer将软件包安装到自定义的"admin"目录中.

Hey I am trying to install a package into a custom 'admin' directory using composer.

这是我的JSON:

{
  "name": "frontier/installer",
  "description": "The best front end engineer package around",
  "require": {
    "aheinze/cockpit": "*"
  },
  "extra":{
    "installer-paths":{
      "admin": ["aheinze/cockpit"]
    }
  }
}

现在,当我运行composer install时,它会全部安装,但默认为vendor/aheinze/cockpit,我一生都无法找出原因.

Now when I run composer install it all installs but defaults to vendor/aheinze/cockpit I cannot for the life of me figure out why.

我已经完成了研究,这应该是正确的代码...是否有明显的错误?

Have done my research this should be the right code... any obvious errors?

干杯.

推荐答案

如果要使用installer-paths选项,则要安装在其他路径中的软件包必须需要composer/installers .

If you want to use the installer-paths option the package you want to be installed in a different path must require composer/installers.

在您的情况下,aheinze/cockpit软件包不需要composer/installers,如您在 composer.json,位于github .

In your case the aheinze/cockpit package doesn't require composer/installers as you can see in its composer.json at github.

看看

Have a look at the composer documentation for custom paths and you see that it tells you:

注意:您不能使用它来更改任何程序包的路径.这仅适用于需要composer/installers并使用其处理的自定义类型的软件包.

Note: You cannot use this to change the path of any package. This is only applicable to packages that require composer/installers and use a custom type that it handles.

这意味着您无法更改此特定软件包的安装路径. 无论如何,我认为没有必要将其安装到默认vendor文件夹的任何其他目录中.

This means you are not able to change the install path of this specific package. Anyway I don't see any necessity to install it into any different directory from the default vendor folder.

这篇关于将软件包安装到自定义目录Composer中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆