//-----------------------------------------------------------------------------
$ composer self-update     
     - 에러 
Command "self-update" is not defined.

     - 원인 
composer 버전이 낮아서 생기는 문제

//-------------------------------------
     - ubuntu 인 경우

     - 기존 버전 삭제
sudo apt-get remove composer

    https://getcomposer.org/download/ 에 나온 설치 스크립트 실행
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'edb40769019ccf227279e3bdd1f5b2e9950eb000c3233ee85148944e555d97be3ea4f40c3c2fe73b22f875385f6a5155') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer

     - 콘솔 다시 접속
    - 하지 않으면 다음 에러 메시지 나올수 있음
-bash: /usr/bin/composer: No such file or directory

 

//-----------------------------------------------------------------------------

* 에러 메시지

[RuntimeException]

Could not load package mews/purifier in http://repo.packagist.org: [UnexpectedValueException] Could not parse version constraint ~4

.*: Invalid version string "~4.*"

 

        - https://packagist.kr 도 동일하게 에러 발생

 

//---------------

* 해결 방법

    - composer 버전을 업그레이드 한다

composer self-update

 

    //------------------------

    - 권한 부족 에러가 나면 

    [ErrorException]

rename(/home/ubuntu/.cache/composer/composer-temp.phar,/usr/local/bin/composer): Permission denied

 

        - 해결 방법

sudo composer self-update

sudo chown ubuntu:ubuntu /home/ubuntu/.composer -R




//------------------------------------------------

composer update가 진행이 안되는 경우

 

 * 에러 상황

        - 다음 메시지 이후로 업데이트가 진행이 안됨

Loading composer repositories with package information

Updating dependencies (including require-dev)

 

 

 * 원인

        - 메모리 부족이 원인이 경우가 많음



 * 해결방법

        - 메모리 많이 쓰는 프로세스 종료 , mysql 등

        - 메모리 사용 무제한 모드로 composer 실행

 

php -d memory_limit=-1 ~/composer.phar update

    - 또는

COMPOSER_MEMORY_LIMIT=-1 ~/composer.phar update



반응형
Posted by codens