yucatio@システムエンジニア

趣味で作ったものいろいろ

create-react-app実行時に@typescript-eslint/eslint-plugin@2.3.2: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".のエラー

エラー内容

create-react-appのバージョンを2.0.4から3.2.0へアップグレードしたところ、yarn create react-appの実行時にエラーが発生しました。

$ yarn create react-app time-in-words
yarn create v1.9.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[------------------------------------------------------------------------] 0/91(node:54333) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Installed "create-react-app@3.2.0" with binaries:
      - create-react-app
[#######################################################################] 92/92
Creating a new React app in /Users/yucatio/react/time-in-words.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.9.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[----------------------------------------------------------------------] 0/1317(node:54337) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
error @typescript-eslint/eslint-plugin@2.3.2: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd /Users/yucatio/react/time-in-words has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting time-in-words/ from /Users/yucatio/react
Done.
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-react-app
Arguments: time-in-words
Directory: /Users/yucatio/react
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

原因

画面には色々書かれていますが、エラーの原因はこの部分のようです。

error @typescript-eslint/eslint-plugin@2.3.2: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1".
error Found incompatible module

こちらで回答されているとおり、nodeのバージョンが古いことが原因ということがわかりました。

node.js - @typescript-eslint/eslint-plugin@2.3.2: The engine "node" is incompatible with this module - Stack Overflow

このエラーが発生した時の関連するパッケージのバージョンです↓

$ yarn info create-react-app version
3.2.0
$ node -v
v10.8.0
$ npm -v
6.2.0

nodeのバージョンが"^8.10.0 || ^10.13.0 || >=11.10.1"でないことがわかります。

対策

nodeのバージョンをあげました。こちらの記事を参考にしました。

parashuto.com

エラーがでた場合はこちらの記事もご覧ください。

yucatio.hatenablog.com

執筆時(2019年12月)のnodeのstableバージョンは12.13.1でしたので、このバージョンにアップデートしました。npmのバージョンは6.13.2にアップデートしました。

その後、yarn create react-appコマンドを実行したところ、正常に実行できました。

環境