【React】There might be a problem with the project dependency tree.が吐き出される

webpackを使い慣れていないので、こんな警告が出て、ビルドエラーが出てしまいました。

There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. Manually installing incompatible versions is known to cause hard-to-debug issues. If prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.

よく見るとエラーというよりは、webpackのバージョンをダウングレードしなさいというもの。本当は良くないのですが、その場しのぎでwebpackのダウングレードをせずに、別の対処法を試してみました。

.envを作成

プロジェクト直下に.envを作成して以下のコードを記述します。

SKIP_PREFLIGHT_CHECK=true

これでビルドができるようになりましたが、「他の問題が起こるかもしれません」という不穏な警告文が書かれていたため、本来としてはダウングレードが正解ですね…。