代码之家  ›  专栏  ›  技术社区  ›  Theo

安装React时出错-发动机不兼容

  •  -1
  • Theo  · 技术社区  · 2 年前

    所以打字之后

    npx create-react-app myapp
    

    error eslint@8.15.0: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "12.13.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 cra-template --cwd /Users/theodosiostziomakas/Desktop/React Tutorial and Project Course (2022)/01_React Basics Tutorial/my-app has failed.
     
     
    Deleting generated file... package.json
    Deleting generated file... yarn.lock
    Deleting my-app/ from /Users/theodosiostziomakas/Desktop/React Tutorial and Project Course (2022)/01_React Basics Tutorial
    Done.
    

    如何更新节点引擎?可能是别的吗?

    谢谢 西奥。

    2 回复  |  直到 2 年前
        1
  •  1
  •   Bryce Stampfl    2 年前

    上面说你当前的node版本是12.13.0,你至少需要12.22.0。

    节点的当前版本为16.15.0 您可以在以下网站下载更新版: https://nodejs.org/en/download/

        2
  •  1
  •   Cosimo Chellini    2 年前

    您使用了错误版本的node。

    IMHO管理节点版本的最佳方法是使用 非挥发性物质 .

    Nvm是一种用于轻松切换节点版本的工具。

    Unix version Windows version

    在你的情况下,你必须:

    • 卸载节点
    • 安装nvm
    • nvm install 12.13.0
    • nvm install 16.0.0
    • nvm use 16.10.0
    • 再试一次 npx create-react-app myapp