在运行create-react-app之前,我从未发生过错误,但是当我今天在Mac上运行它时,我一直收到以下错误,但无法解决。我试过更新节点,Yarn,eslint,CRA,还清除了节点缓存,但没有任何效果。为什么会发生此错误,如何解决该错误,以便我可以安装create-react-app?
Creating a new React app in /Users/...
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error eslint@5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.3.0"
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/johnwolfe/printPackageTest/printtest has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting printtest/ from /Users/johnwolfe/printPackageTest
Done.
答案 0 :(得分:1)
错误
错误eslint@5.6.0:引擎“节点”与此不兼容 模块。预期版本为“ ^ 6.14.0 || ^ 8.10.0 ||> = 9.10.0”。得到了“ 9.3.0” 错误发现模块不兼容
问题
为什么会发生此错误,我该如何解决,这样我才能安装 创建反应应用程序?
答案
您可能会考虑更新NodeJS版本:)很明显,这是NodeJS与create-react-app之间的不兼容问题
答案 1 :(得分:0)
我也遇到了同样的问题,请在创建react应用程序推荐的末尾添加“ --use-npm”。
create-react-app appname --use-npm
黑客很开心!