因为是想搭建一个后台系统,所以组件直接定了antd,脚手架以create-react-app为基准,加上redux和sass(因为我一直用的less,这次换个口味),搭建一个简单的项目。安装依赖首先安装create-react-appnpm i create-react-app给项目起个名字create-react-app my_react_cli(项目名)啪嗒回车,开始安装项目,此过程会持续几分钟,可以去干点别的~安装完成后,就是下图的样子了图片描述运行一下看看,有没有问题npm start图片描述 There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create React App requires a dependency: “babel-loader”: “8.0.4” Don’t try to install it manually: your package manager does it automatically. However, a different version of babel-loader was detected higher up in the tree: C:\Users\liu\node_modules\babel-loader (version: 7.1.5)因为文主之前搭建别的项目时安装了babel-loader,导致的版本不对,那就卸掉babel-loader,按照所需的8.0.4版本安装一下卸载babel-loadernpm uninstall babel-loader 然后安装正确的版本npm i babel-loader@8.0.4可能会出现再次报错的情况,可以删掉在你的项目文件夹里面的 node_modules重新安装继续安装各种依赖这里我暂时装了antd@3.12.1和react-redux@6.0.0运行一下看看图片描述接下里就要开始封装公共方法休息一下 有空再写