无法使用 create-react-app 创建应用

Can not create app using create-react-app

当我尝试使用 create-react-app 创建应用程序时出现错误

error eslint@5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0".

error Found incompatible module info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

我的node版本是8.9.3

我的 NPM 版本是 6.4.1

我的 create-react-app 版本是 1.5.2

显示项目无法创建给定错误。

如您所见,您需要更新您的 Node 版本

为此,请运行:npm install npm@latest -g

https://nodejs.org/en/

更新你的nodejs版本

我遇到这个问题是因为我的节点包不是最新的。我收到此错误消息:

error eslint@6.3.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "11.10.0"

经过一番谷歌搜索后,我偶然发现了这个... https://www.surrealcms.com/blog/how-to-upgrade-or-downgrade-nodejs-using-npm.html

并且发现我的解决方案是使用这个 npm 命令来更新最新稳定版本的节点。

sudo n stable

瞧瞧!

问题显然是由于节点版本不兼容造成的。

安装一个名为 n 的程序,它可以让您在 Node 版本之间切换。

sudo npm install -g n

更新到最新稳定版本的 Node。

sudo n stable

现在使用 create-react-app

npm install create-react-app

create-react-app myapp

你可以试试这个 cms:

yarn config set ignore-engines true