Drupal 7 で drush pm-update コマンドが失敗するときの対処方法

Drupal 7

問題

Drupal 7 で drush pm-update (もしくは drush up )コマンドを実行すると下記のようなエラーが出て処理が失敗してしまいます。

$ drush up entity
Illegal string offset 'site' backend.inc:1037       [warning]
The command could not be executed successfully      [error]
(returned:  Name        Installed  Proposed  Message

             Version    version
 Entity API  7.x-1.6    7.x-1.7   アップデー
 (entity)                         トが利用
                                  能です

DRUSH_BACKEND_OUTPUT_START>>><<<DRUSH_BACKEND_OUTPUT_END,
code: 0)
pm-updatestatus failed.                             [error]

原因

この問題の原因は「モジュールの更新情報の文字列を drush がうまく認識できないこと」にあります。 細かい原因まで把握できていませんが、テーブル状で表示されるモジュール更新情報を drush がうまく parse できないときにどうも発生するようです。 私はターミナルの画面幅が狭く更新情報のテーブルがレイアウト崩れを起こすときにこのエラーが発生しました。

対処方法

モジュールの更新情報をきれいな表形式で表示できるようにターミナルの画面を拡げるか文字サイズを小さくします。

参考に、私の場合の成功例のサンプルを貼り付けておきます。 単純にターミナルの画面幅を広くしただけで結果が変わりました。

$ drush up entity
Update information last refreshed: 2016.03.19 23:00
 Name        Installed  Proposed  Message
             Version    version
 Entity API  7.x-1.6    7.x-1.7   アップデー
 (entity)                         トが利用可
                                  能です

Code updates will be made to the following projects: Entity API [entity-7.x-1.7]

Note: A backup of your project will be stored to backups directory if it is not managed by a supported version control system.
Note: If you have made any modifications to any file that belongs to one of these projects, you will have to migrate those modifications after updating.
Do you really want to continue with the update process? (y/n):

アバター
後藤隼人 ( ごとうはやと )

ソフトウェア開発やマーケティング支援などをしています。詳しくはこちら