Vue项目部署到jenkins的实现
更新时间:2022年02月16日 14:15:17 作者:舌尖上的蛋炒饭
本文主要介绍了Vue项目部署到jenkins的实现,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
服务器配置环境
需要安装yarn命令,但是yarn是通过npm安装的,所以要先安装npm,npm又是node附带的,所以要安装node
[root@hecs-82454 local]# pwd /usr/local [root@hecs-82454 local]# wget https://nodejs.org/dist/v14.15.4/node-v14.15.4-linux-x64.tar.xz [root@hecs-82454 local]# tar -xf node-v14.15.4-linux-x64.tar.xz [root@hecs-82454 local]# mv node-v14.15.4-linux-x64 node [root@hecs-82454 local]# cd /usr/bin [root@hecs-82454 bin]# ln -s /usr/local/node/bin/node node [root@hecs-82454 bin]# ln -s /usr/local/node/bin/npm npm [root@hecs-82454 bin]# find / -name yarn /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/lib/node_modules/corepack/shims/yarn /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/lib/node_modules/corepack/shims/nodewin/yarn /usr/local/node/bin/yarn /usr/local/node/lib/node_modules/yarn /usr/local/node/lib/node_modules/yarn/bin/yarn [root@hecs-82454 bin]# ln -s /usr/local/node/bin/yarn yarn [root@hecs-82454 bin]# yarn -v 1.22.17 [root@hecs-82454 bin]# npm -v 6.14.10 [root@hecs-82454 bin]# node -v v14.15.4
配置到jenkins上




git clean -df; git checkout .; rm -rf node_modules; rm -rf package-lock.json; yarn cache clean; yarn config set registry https://registry.npm.taobao.org -g; yarn install --registry=https://registry.npm.taobao.org/; yarn build;
看看jenkins干了什么
首先打印出了工作空间

然后通过build命令生成了dist文件,这就是我们想要的

[root@hecs-82454 bin]# cd /var/lib/jenkins/workspace/vueDataCenter [root@hecs-82454 vueDataCenter]# ls babel.config.js dist images node_modules package.json public README.md src vue.config.js yarn.lock
如果你要需要将打包好的dist文件发到远程主机里,除了解压缩之外,还要记得给自己的文件赋权

tar -xzvf /czb/publish/data/mstest3/dist.tar.gz -C /czb/publish/data/mstest3; cp -r /czb/publish/data/mstest3/dist/* /czb/www/mstest3/; chmod 755 /czb/www/mstest3/* -R;
到此这篇关于Vue项目部署到jenkins的实现的文章就介绍到这了,更多相关Vue项目部署到jenkins内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
您可能感兴趣的文章:
相关文章
vue element-ui 绑定@keyup事件无效的解决方法
遇到vue element-ui 绑定@keyup事件无效的问题怎么解决?下面小编就为大家分享一篇vue element-ui 绑定@keyup事件无效的解决方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧2018-03-03
Vuex持久化插件(vuex-persistedstate)解决刷新数据消失的问题
这篇文章主要介绍了Vuex持久化插件(vuex-persistedstate)-解决刷新数据消失的问题,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2019-04-04
Vue ElementUI table实现双击修改编辑某个内容的方法
在实现表格单元格双击编辑功能时,需使用@cell-dblclick事件来触发双击操作,将单元格切换为input输入框,通过ref引用和绑定失焦及回车事件来确认编辑,同时,需要处理编辑数据的更新和方法逻辑的完善2024-09-09


最新评论