VS Code React 安装问题

VS Code React 安装问题
$ npx create-react-app my-app
npx: installed 67 in 8.478s

Creating a new React app in /home/unaiz/Desktop/mango/my-app.

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

yarn add v1.22.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^10.12.0 || >=12.0.0". Got "11.15.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 /home/unaiz/Desktop/mango/my-app has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

答案1

您的 node.js 版本与某些 react 包不兼容。

安装Node.js latest LTS version 14.17.0,像这样

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

相关内容