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

无法自我更新 Composer

Unable to self-update Composer(无法自我更新 Composer)

本文介绍了无法自我更新 Composer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新 Composer,但运气不佳!

我尝试过的:

$ composer 自我更新

<块引用>

[无效参数异常]命令自我更新"没有定义.

$ sudo -H composer 自我更新

<块引用>

[无效参数异常]命令自我更新"没有定义.

$ sudo apt-get install composer

<块引用>

正在读取包列表...完成构建依赖树读取状态信息...完成作曲家已经是最新版本.这以下软件包已自动安装并且不再必需:libntdb1 linux-headers-4.2.0-30linux-headers-4.2.0-30-generic linux-image-4.2.0-30-genericlinux-image-extra-4.2.0-30-generic python-ntdb 使用'apt-getautoremove' 删除它们.0 升级,0 新安装,0 删除还有 10 个没有升级.

我正在尝试自我更新 Composer,因为我每次尝试都面临以下问题:

$ 作曲家更新

<块引用>

使用包信息加载作曲家存储库更新依赖项(包括require-dev)[运行时异常]无法加载包 rmrevin/yii2-fontawesomehttp://packagist.org:[UnexpectedValueException] 无法解析版本约束 v4.1 .:无效的版本字符串v4.1."[意外值异常]无法解析版本约束 v4.1.:版本字符串无效v4.1."

我该如何解决这个问题?

我的 PHP 版本是:

php --version

<块引用>

PHP 5.6.11-1ubuntu3.4 (cli) 版权所有 (c) 1997-2015 The PHP GroupZend Engine v2.6.0,版权所有 (c) 1998-2015 Zend Technologies使用 Zend OPcache v7.0.6-dev,版权所有 (c) 1999-2015,由 Zend Technologies 提供

我的作曲家版本是:

作曲家 --version

<块引用>

Composer 版本@package_branch_alias_version@ ​​(@package_version@)@release_date@

解决方案

自从我发布我的答案后,我学会了一种更简单的以编程方式安装 Composer 的新方法:如何以编程方式安装 Composer?

旧答案:


根据@JimL 的评论,我可以通过以下方式自行更新 Composer:

  • 从包管理器 (apt) 中卸载 Composer.
  • 我是按照官方文档安装的

现在它可以按预期工作了.

I am trying to update Composer without any luck!

What I have tried:

$ composer self-update

[InvalidArgumentException] Command "self-update" is not defined.

$ sudo -H composer self-update

[InvalidArgumentException] Command "self-update" is not defined.

$ sudo apt-get install composer

Reading package lists... Done Building dependency tree Reading state information... Done composer is already the newest version. The following packages were automatically installed and are no longer required: libntdb1 linux-headers-4.2.0-30 linux-headers-4.2.0-30-generic linux-image-4.2.0-30-generic linux-image-extra-4.2.0-30-generic python-ntdb Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

I am trying to self-update Composer because I am facing the following each time I try:

$ composer update

Loading composer repositories with package information Updating dependencies (including require-dev) [RuntimeException] Could not load package rmrevin/yii2-fontawesome in http://packagist.org: [UnexpectedValueException] Could not parse version constraint v4.1 .: Invalid version string "v4.1." [UnexpectedValueException] Could not parse version constraint v4.1.: Invalid version string "v4.1."

How can I fix this issue?

My PHP version is:

php --version

PHP 5.6.11-1ubuntu3.4 (cli) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

My composer version is:

composer --version

Composer version @package_branch_alias_version@ (@package_version@) @release_date@

解决方案

Since I posted my answer, I have learnt a new easier way to install Composer programmatically: How do I install Composer programmatically?

Old Answer:


As per @JimL comment, I was able to self update Composer by:

  • Uninstalling Composer from the package manager (apt).
  • I installed it according to the official documentation

Now it works as expected.

这篇关于无法自我更新 Composer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:无法自我更新 Composer

基础教程推荐