首頁 >開發工具 >composer >composer 伺服器安裝擴充功能失敗怎麼辦

composer 伺服器安裝擴充功能失敗怎麼辦

藏色散人
藏色散人轉載
2019-09-23 14:12:273649瀏覽

因为版本过低而导致composer服务器安装扩展失败怎么呢?下面由composer教程栏目给大家介绍其升级过程!

composer 伺服器安裝擴充功能失敗怎麼辦

ps : 服务器 配置

Linux VM-0-9-ubuntu 4.4.0-91-generic #114-Ubuntu SMP Tue Aug 8 11:56:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

1. 失败经历

安装 easyswoole 的过程中,发现无法通过 composer 安装

报错信息如下:

ubuntu@VM-0-9-ubuntu:~/demo/easyswoole$ composer require easyswoole/easyswoole=3.x
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Installation failed, deleting ./composer.json.
                                                                                           
  [ErrorException]                                                                         
  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?  
                                                                                           
require [--dev] [--prefer-source] [--prefer-dist] [--no-plugins] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [<packages>]..

google 一下,没有对应的错误信息。 想着先查看一下 composer 版本

发现 : composer 版本过低,就顺便升级composer 升级了再说。

ubuntu@VM-0-9-ubuntu:~/demo/easyswoole$ composer -V
Composer version @package_branch_alias_version@ (1.0.0-beta2) 2016-03-27 16:00:34

升级的过程中发现,升级失败。 老版本的 composer 不能自动升级

ubuntu@VM-0-9-ubuntu:~$ composer self-update
                                         
  [InvalidArgumentException]             
  Command "self-update" is not defined.

看来是 composer 包太低,都没有自动升级的功能

2. 下载新的 composer 包

1. 新增最新的composer

wget https://dl.laravel-china.org/composer.phar -O /usr/local/bin/composer
 sudo chmod a+x /usr/local/bin/composer

然后把脚本 覆盖到原来的 (通过软链)

2. 查看原来的位置

composer 伺服器安裝擴充功能失敗怎麼辦

sudo mv /usr/bin/composer /tmp/ 
sudo ln -s /usr/local/bin/composer  /usr/bin/composer 
ubuntu@VM-0-9-ubuntu:~$ composer -V
Composer version 1.8.5 2019-04-09 17:46:47

3. 安装

使用 composer 安装项目

composer 伺服器安裝擴充功能失敗怎麼辦

以上是composer 伺服器安裝擴充功能失敗怎麼辦的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:segmentfault.com。如有侵權,請聯絡admin@php.cn刪除