- 安装pm2模块
cnpm install pm2@latest -g
https://www.cnblogs.com/liusixin/p/7007340.html
pm2常用指令 - 编写
deploy.sh
,放在vue项目 根目录下
echo "删除dist文件"
rm -rf dist
echo "删除完成"
echo "拉取代码..."
git pull origin master
echo "拉取完成"
cnpm run build
echo "转移dist文件到部署目录下..."
rm -rf vue_deploy/dist
mv -i dist vue_deploy/
echo "转移成功"
echo "安装依赖..."
cd vue_deploy
cnpm install
echo "安装完成"
echo "重启服务..."
pm2 stop app.js
pm2 start app.js
echo "重启完成"
*创建与