0
0

More than 1 year has passed since last update.

PHP-CS-Fixerインストール出来ないエラーと解決方法

Last updated at Posted at 2021-09-23

PHP-CS-Fixerのインストール時、エラーが出たのと解決方法が分かったので記載。ただし自身が学習中の初心者で内容が浅すぎるのと、ググっても同様のエラーが見当たらなかったため、もし相違あればコメント下さい。

環境

Ver
Mac OS 11.5.2
PHP 7.3.24
Laravel 8.37.0

エラー内容

- Root composer.json requires friendsofphp/php-cs-fixer ^3.1 -> satisfiable by friendsofphp/php-cs-fixer[v3.1.0].
- friendsofphp/php-cs-fixer v3.1.0 requires symfony/polyfill-php72 ^1.23 -> found symfony/polyfill-php72[dev-main, v1.23.0, 1.23.x-dev (alias of dev-main)] but the package is fixed to v1.22.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

以下DeepL翻訳。

ルートのcomposer.jsonにはfriendsofphp/php-cs-fixerが必要です
^3.1 -> friendsofphp/php-cs-fixer[v3.1.0]で満たします。

friendsofphp/php-cs-fixer v3.1.0 requires symfony/polyfill-php72 ^1.23 -> symfony/polyfill-php72[dev-main, v1.23.0, 1.23.x-dev (dev-mainのエイリアス)]が見つかりましたが、パッケージは部分アップデートでv1.22.1(ロックファイルのバージョン)に修正されており、そのバージョンは一致しません。update コマンドの引数としてリストアップしていることを確認してください。

解決方法

エラーログに載っていた。

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

現在、特定のバージョンにロックされているパッケージのアップグレード、ダウングレード、削除を許可するには、--with-all-dependencies (-W) オプションを使用します。

よって次のコマンドを入力。

composer require --dev friendsofphp/php-cs-fixer --with-all-dependencies
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0