简体   繁体   English

如何使用Composer安装Composer?

[英]How to install Composer using Composer?

EDIT: solved, I have to use "dev-master" instead of "master" or "dev". 编辑:解决了,我必须使用“ dev-master”而不是“ master”或“ dev”。

maybe this seems weird to you... but I'm trying to locally install composer using a global composer binary. 也许这对您来说很奇怪...但是我正在尝试使用全局composer二进制文件在本地安装composer。

I'm trying to write something like: 我正在尝试写类似:

composer require composer/composer

But this doesn't work, it tells me that needs the version. 但这不起作用,它告诉我需要版本。 Then I've tried the following variations: 然后,我尝试了以下变体:

composer require composer/composer=*
composer require composer/composer=master
composer require composer/composer=dev

And... nothing, I obtain the following error message: 而且...什么也没有,我得到以下错误消息:

Your requirements could not be resolved to an installable set of packages.

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

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

Anyone has any idea if it's possible to do it in a "clean" way? 任何人都知道是否有可能以“干净”的方式做到这一点? (Allowing the following points): (允许以下几点):

  • specifying a very concrete version 指定一个非常具体的版本
  • registering it in the composer.json and composer.lock files 在composer.json和composer.lock文件中注册它
  • placing the composer binary with other php binaries like behat ... 将composer二进制文件与其他php二进制文件(如behat)一起放置...

Don't understand why do you want this, but I think #EDIT : Saw why you need this. 不明白为什么要这样,但是我认为#EDIT:看到了为什么需要这个。 Ok. 好。

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/composer/composer.git"
    }
],
"require": {
    "composer/composer": "dev-master#775f6cd5c633facf2e7b99611fdcaa900b58ddb7"
}

would work. 会工作。

You can view here the commit hash corresponding to different releases : https://github.com/composer/composer/releases 您可以在此处查看与不同发行版相对应的提交哈希: https : //github.com/composer/composer/releases

Ok, I've made a stupid mistake. 好的,我犯了一个愚蠢的错误。 I have to use "dev-master", not "dev" nor "master". 我必须使用“ dev-master”,而不是“ dev”或“ master”。

Sorry for this dumb question. 很抱歉这个愚蠢的问题。

Well, it seems to me that you are trying to install composer using composer itself. 好吧,在我看来,您正在尝试使用composer本身安装composer。 That of course is not possible. 那当然是不可能的。 To install composer you need to first download it from here . 要安装作曲家,您需要先从这里下载它。 Once you have done that you will be able to install packages using the 'require' command. 完成后,您将可以使用“ require”命令安装软件包

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM