composer更新出现 Command "self-update" is not defined

2019-03-22

我使用的是ubuntu 16.04版本,出现这个问题的原因是,ubuntu库中的composer,不能完成self-update
所以我们要先移除原来的composer:

sudo apt-get remove composer

移除成功后,以composer官方的方式下载composer:

curl -sS https://getcomposer.org/installer | php

并将下载的composer.phar 移动到以下命令指定的目录,使所有用户全局都可以使用composer:

sudo mv composer.phar /usr/bin/composer
chmod +x /usr/local/bin/composer

完成输入:

composer

你会得到一个新版的完整的composer

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.8.4 2019-02-11 10:52:10

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
@2024  TCODE    津ICP备13002520号-4