简体   繁体   English

如何使用 Composer 安装 fpoirotte/cryptal?

[英]How can I install fpoirotte/cryptal with composer?

I can't install https://packagist.org/packages/fpoirotte/cryptal .我无法安装https://packagist.org/packages/fpoirotte/cryptal Per packagist.org I should be able to do composer require fpoirotte/cryptal via the CLI but whenever I try to do so I get the following error:根据 packagist.org,我应该能够通过 CLI 执行composer require fpoirotte/cryptal但每当我尝试这样做时,我都会收到以下错误:

  [InvalidArgumentException]
  Could not find package fpoirotte/cryptal.

  Did you mean one of these?
      fpoirotte/cryptal
      fpoirotte/cryptal-hash
      fpoirotte/cryptal-sodium
      fpoirotte/cryptal-mcrypt
      fpoirotte/cryptal-openssl


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

I'm able to install other composer packages without issue.我可以毫无问题地安装其他 Composer 软件包。 It's just this one that's having issues..只有这个有问题。。

The default minimum stability for composer is "stable". composer 的默认最低稳定性是“稳定的”。

From the docs :文档

"minimum-stability" (root-only): This defines the default behavior for filtering packages by stability. “minimum-stability”(仅限root):这定义了按稳定性过滤包的默认行为。 This defaults to stable, so if you rely on a dev package, you should specify it in your file to avoid surprises.这默认为 stable,所以如果你依赖一个 dev 包,你应该在你的文件中指定它以避免意外。

And on the other hand, the package you are trying to install only has a "master" branch and no version tags, so it is considered a "dev" dependency.另一方面,您尝试安装的软件包只有一个“master”分支而没有版本标签,因此它被视为“dev”依赖项。

You have to options to install this package:您必须选择安装此软件包:

Edit your composer.json to include:编辑您的 composer.json 以包括:

"minimum-stability": "dev",

Although this changes your minimum stability requirements for the whole project, so it may not be ideal.虽然这改变了你对整个项目的最低稳定性要求,所以它可能并不理想。

Require a specific version需要特定版本

If you do composer require fpoirotte/cryptal:master-dev you'll be able to install this package keeping your minimum-stability settings to stable .如果你做composer require fpoirotte/cryptal:master-dev你将能够安装这个包,保持你的 minimum-stability 设置为stable


I do not know what version of composer you are running, but it may be worth to update it.我不知道您正在运行什么版本的作曲家,但更新它可能是值得的。 The error I get with my version is much more explicit:我的版本出现的错误更加明确:

[InvalidArgumentException] [无效参数异常]

Could not find a version of package fpoirotte/cryptal matching your minimum-stability (stable).找不到与您的最低稳定性(稳定)匹配的软件包 fpoirotte/cryptal 版本。 Require it with an explicit version constraint allowing its desired stability.要求它具有明确的版本约束,以允许其所需的稳定性。

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

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