0. 序 -- 使用包管理工具
默认使用yarn
1. 克隆线上仓库到本地
国内仓库:git@gitee.com:element-plus/element-plus.git
国外仓库:git@github.com:element-plus/element-plus.git
git clone git@gitee.com:element-plus/element-plus.git
2. 安装依赖(进入element-plus目录)
yarn
或者
npm install
3. 启动项目
--3.1
yarn bootstrap
--3.2(如果没有执行3.1,而直接执行3.2,则会报错(Can't resolve './version))
yarn website-dev
--3.3 debugger
3.3.1 问题出现
随后报:Error: Cannot find module 'libnpx'
3.3.2 解决问题
终于在stackoverflow: No need to delete any files as for the above issue. So, to fix the problem just install the node from: https://nodejs.org/en/
3.3.3 引出新问题
如果没有使用nvm等node版本管理,则直接官网下载,替换即可
3.3.4 nvm安装最新的node
(1)nvm install latest 报错: Downloading npm version 7.15.1... Error while downloading https://github.com/npm/cli/archive/v7.15.1.zip - Get https://github.com/npm/cli/archive/v7.15.1.zip: net/http: TLS handshake timeout
这是因为npm没有安装成功
(2)找到nvm/setting.txt,把npm和node下载地址切换到国内镜像
arch: 64 node_mirror: https://npm.taobao.org/mirrors/node/ npm_mirror: https://npm.taobao.org/mirrors/npm/
(3)继续下载即可
nvm install 16.3.0
之后
nvm use 16.3.0
(4)如果使用yarn,还需要
npm install yarn -g
(5)完美解决
继续运行3.1和3.2,打开查看element-plus本地服务即可