【问题标题】:Unusual error when running create-react-app in terminal on Mac在 Mac 上的终端中运行 create-react-app 时出现异常错误
【发布时间】:2018-10-07 02:05:04
【问题描述】:

我在运行 create-react-app 之前从未出现过错误,但是当我今天在我的 Mac 上运行它时,我不断收到以下错误并且无法解决它。我试过更新节点、纱线、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.

【问题讨论】:

    标签: reactjs npm create-react-app yarnpkg


    【解决方案1】:

    错误

    error eslint@5.6.0: 引擎“节点”与此不兼容 模块。预期版本“^6.14.0 || ^8.10.0 || >=9.10.0”。得到“9.3.0” 错误发现不兼容的模块

    问题

    为什么会出现此错误以及如何解决它以便可以安装 创建反应应用程序?

    回答

    您可能会考虑更新您的 NodeJS 版本 :) 很明显,这是您的 NodeJS 和 create-react-app 之间不兼容的问题

    【讨论】:

    • 谢谢。我的愚蠢错误。我以为我已经升级了它。
    【解决方案2】:

    我遇到了同样的问题,尝试在 create react app 推荐的末尾添加“--use-npm”。

    create-react-app appname --use-npm
    

    黑客愉快!

    【讨论】:

      猜你喜欢
      • 2019-06-11
      • 1970-01-01
      • 1970-01-01
      • 2019-05-07
      • 1970-01-01
      • 1970-01-01
      • 2015-06-01
      • 2020-11-04
      • 2020-09-22
      相关资源
      最近更新 更多