Saturday, July 2, 2016

Solusi Gagal Update Yii2 melalui Composer

Setelah agak lama vakum, karena kerjaan banyak, ternyata yii2 sudah ada update yang terbaru lagi, namun ketika akan melakukan update melalui composer mengalami sedikit kendala, bagi teman yang mengalami kasus sama mungkin tulisan ini bisa di jadikan sedikit pencerahan.

untuk update yii2 yang pertama saya lakukan adalah berusaha mengupdate composer terlebih dahulu.

        php composer.phar self-update
ternyata gagal dan rollback ke versi lama,
         You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Updating to version 1.1.3.
    Downloading: 100%
Use composer self-update --rollback to return to version 1.0.0
tanpa mempedulikan error tersebut saya berusaha melakukan update yii2 ke versi terbaru, siapa tahu bisa.
             php composer.phar update
ternyata gagal juga dan keluar error seperti ini
             The "yiisoft/yii2-composer" plugin was skipped because it requires a Plugin API version ("1.0.0") that does not match your Composer installation ("1.1.0"). You may need to run composer update with the "--no-plugins" option.


  [ReflectionException]
  Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist



  [ErrorException]
  Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository
  ::whatProvides() should be compatible with Composer\Repository\ComposerRepo
  sitory::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypass
  Filters = false)

dari kata-kata error tersebut yaitu : The "yiisoft/yii2-composer" plugin was skipped because it requires a Plugin API version ("1.0.0") that does not match your Composer installation ("1.1.0"). You may need to run composer update with the "--no-plugins" option.  
sepertinya dapat disimpulkan bahwa sebenarnya yang bikin error adalah composer yang tidak ter-update, tapi kok di update juga ga bisa? bingung.
dari saran tersebut, kayaknya kita harus menambahkan opsi --no-plugins

           php composer.phar update yiisoft/yii2-composer --no-plugins
atau bisa juga dengan script ini, sama aja.
          php composer.phar self-update  --no-plugins
ternyata success.
              You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing yiisoft/yii2-composer (2.0.3)
  - Installing yiisoft/yii2-composer (2.0.4)
    Downloading: 100%

Writing lock file
Generating autoload files
update composer telah berhasil, saatnya update yii2-nya.
                 php composer.phar update
ternyata masih error juga, tapi tampaknya pesan errornya sudah berubah.
              [ReflectionException]
  Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist



  [ErrorException]
  Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository
  ::whatProvides() should be compatible with Composer\Repository\ComposerRepo
  sitory::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypass
  Filters = false)
ternyata sekarang asset pluginnya tidak ditemukan, entah mungkin terhapus atau tidak ter-update. kemudian saya berusaha menambahkan asset plugin kembali seperti ini :
            php composer.phar global require "fxp/composer-asset-plugin:~1.1.1"
yah error juga
            Changed current directory to C:/Users/Admin/AppData/Roaming/Composer


  [ReflectionException]
  Class Fxp\Composer\AssetPlugin\Repository\NpmRepository does not exist



  [ErrorException]
  Declaration of Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository
  ::whatProvides() should be compatible with Composer\Repository\ComposerRepo
  sitory::whatProvides(Composer\DependencyResolver\Pool $pool, $name, $bypass
  Filters = false)

kemudian saya coba dengan mengupdate nya dengan tambahan opsi --no-plugins
            php composer.phar global update fxp/composer-asset-plugin --no-plugins

ternyata success,
        Changed current directory to C:/Users/Admin/AppData/Roaming/Composer
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing fxp/composer-asset-plugin (v1.1.1)
  - Installing fxp/composer-asset-plugin (v1.1.4)
    Downloading: 100%

Writing lock file
Generating autoload files

kemudian saya coba lagi update yii2
            php composer.phar update
dan kali ini berhasil update ke versi terbaru dengan menggunakan composer.
       You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing bower-asset/fontawesome (v4.5.0)
  - Removing swiftmailer/swiftmailer (v5.4.1)
  - Installing swiftmailer/swiftmailer (v5.4.2)
    Downloading: 100%
................................................
Writing lock file
Generating autoload files

1 comment:

Silahkan manfaatkan moments ini untuk berdiskusi