正在中止安装 yarnpkg add --exact react react-dom react-scripts cra-template --cwd /home/ficho/workspace/storybook-tutorial 失败

问题描述

我无法创建新的 React 应用程序。 到目前为止它工作得很好,但今天我必须安装纱线,因为我会得到这个错误,当我尝试创建一个新的反应应用程序时:

➜  workspace npx create-react-app storybook-tutorial

Creating a new React app in /home/ficho/workspace/storybook-tutorial.

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

yarn add v1.22.10
[1/4] Resolving packages...
warning react-scripts > babel-eslint@10.1.0: babel-eslint is Now @babel/eslint-parser. This package will no longer receive updates.
warning react-scripts > workBox-webpack-plugin > workBox-build > @hapi/joi@15.1.1: Switch to 'npm install joi'
warning react-scripts > workBox-webpack-plugin > workBox-build > rollup-plugin-babel@4.4.0: This package has been deprecated and is no
 longer maintained. Please use @rollup/plugin-babel.
warning react-scripts > jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9:
 request-promise-native has been deprecated because it extends the Now
 deprecated request package,see
 https://github.com/request/request/issues/3142
warning react-scripts > jest > @jest/core > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been
 deprecated,see https://github.com/request/request/issues/3142
[2/4] Fetching packages...
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and Failed compatibility check. Excluding it from installation.
info fsevents@2.3.1: The platform "linux" is incompatible with this module.
info "fsevents@2.3.1" is an optional dependency and Failed compatibility check. Excluding it from installation.
error postcss@8.2.4: The engine "node" is incompatible with this module. Expected version "^10 || ^12 || >=14". Got "13.8.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/ficho/workspace/storybook-tutorial has Failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting storybook-tutorial/ from /home/ficho/workspace
Done.

我使用 Ubuntu 18.4。

我尝试清除缓存:yarn cache clear 并更新 npm npm install -g npm@latest

解决方法

升级你的 node.js 可以解决这个问题。