要求:Node>=8.10 并且 npm>=5.6
建议:Node>=10.14.2,否则会报错:error babel-jest@26.6.3: The engine "node" is incompatible with this module. Expected version ">= 10.14.2". Got "10.13.0"
1、安装 create-react-app
npm install -g create-react-app // Windows
sudo npm install -g create-react-app // Linux
2、检测 create-react-app 是否安装成功
create-react-app -V // 注意:V 是大写的
3、创建 react 项目
npx create-react-app <项目名称>// 注意:名字不能包含大写字母。我的是 my-app。
cd my-app
npm start
说明:npx 是 npm 5.2+ 附带的 package 运行工具。