设为首页 加入收藏

TOP

centos7本地部署element-plus
2023-07-23 13:39:33 】 浏览:17
Tags:centos7 element-plus

element-plus官网实在是太不稳定了,所以自己搭建了一套在本地,流程如下:

  1. 环境安装

        yum install git
    yum install nodejs
    npm install -g pnpm
    
  2. 从gitee拉取代码

     wget -P /opt/element-plus https://gitee.com/element-plus/element-plus/repository/archive/dev.zip
     这代表代码的压缩文件被下载到了/opt/element-plus,解压此压缩包
     cd /opt/element-plus
     unzip dev.zip
     得到了element-plus-dev源代码
     cd /element-plus-dev/docs
     安装依赖包
     pnpm install
    
  3. 打包发布

     先本地化一下语言,npm run gen-locale
     再执行打包命令,npm run build
     一般这个时候会报错,内存溢出,89691 ms: Mark-sweep 902.2 (931.7) -> 898.0 (932.4) MB, 511.4 / 0.1 ms  (average mu = 0.217, current mu = 0.132) allocation failure scavenge might not succeed
     解决方法如下:npm install -g increase-memory-limit
     在项目目录doc路径下:increase-memory-limit
     然后再打包就可以完成,生产的dist文件夹在docs/.vitepress/dist
     把这个dist挂到nginx,即可丝滑访问
    
  4. 从gitee持续拉取,获取最新版文档
    (1) 编写shell脚本

     vim /opt/element-plus/deploy.sh
     并添加执行权限,chmod 777 deploy.sh
    
    #!/bin/bash 
    rm -rf /opt/element-plus/dev.zip
    rm -rf /opt/element-plus/element-plus-dev/
    wget -P /opt/element-plus https://gitee.com/element-plus/element-plus/repository/archive/dev.zip
    cd /opt/element-plus
    unzip dev.zip
    cd /opt/element-plus/element-plus-dev/docs
    pnpm install
    increase-memory-limit
    npm run gen-locale
    npm run build
    

    (2) 配置定时任务

     检查有没有crontab服务,`systemctl status crond.service`,
     如果有,设置开机自动运行,`systemctl enable crond.service`
     如果没有,`yum install crontabs`,完了也enable一下,开机自启动
     配置定时拉取任务,`crontab -e`
     `0 1 * * * sh /opt/element-plus/deploy.sh`
    
  5. 完工
    遗憾就是发布出来的是英文版的,中文版还不知道怎么弄

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Liunx Vim常用命令 下一篇CentOS7.9 搭建内部yum源服务器同..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目