react-redux-antd項目搭建

由於是想搭建一個後臺系統,因此組件直接定了antd,腳手架以create-react-app爲基準,加上redux和sass(由於我一直用的less,此次換個口味),搭建一個簡單的項目。node

  1. 安裝依賴

首先安裝create-react-appreact

npm i create-react-app

給項目起個名字npm

create-react-app my_react_cli(項目名)

啪嗒回車,開始安裝項目,此過程會持續幾分鐘,能夠去幹點別的~redux

運行一下看看,有沒有問題sass

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-loaderbabel

npm uninstall babel-loader

而後安裝正確的版本antd

npm i babel-loader@8.0.4

可能會出現再次報錯的狀況,能夠刪掉在你的項目文件夾裏面的 node_modules從新安裝
繼續安裝各類依賴
這裏我暫時裝了antd@3.12.1和react-redux@6.0.0
運行一下看看app

接下里就要開始封裝公共方法less

休息一下 有空再寫ide

相關文章
相關標籤/搜索