Home  >  Article  >  Development Tools  >  What to do if the composer server fails to install extensions

What to do if the composer server fails to install extensions

藏色散人
藏色散人forward
2019-09-23 14:12:273580browse

What should I do if the composer server fails to install extensions because the version is too low? Below, the composer tutorial column will introduce you to the upgrade process!

What to do if the composer server fails to install extensions

ps : Server Configuration

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. Failure experience

In the process of installing easyswoole, it was found that it could not be installed through composer

The error message is as follows:

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 it and there is no corresponding error message. I thought about checking the composer version first

and found that the composer version was too low, so I upgraded composer by the way.

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

During the upgrade process, it was discovered that the upgrade failed. The old version of composer cannot be automatically upgraded

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

It seems that the composer package is too low and does not have the automatic upgrade function

2. Download the new composer package

1. Add the latest composer

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

and then overwrite the script to the original one (via soft link)

2. View the original location

What to do if the composer server fails to install extensions

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. Installation

Use composer to install the project

What to do if the composer server fails to install extensions

The above is the detailed content of What to do if the composer server fails to install extensions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete