前言
个人笔记,最近学习前端,服务器运维,记录一下前端打包发布
安装
- node js
apt install nodejs
- npm
apt install npm
- cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 服务器死活无法升级nodejs,原因版本过低的
wget -qO- https://deb.nodesource.com/setup_10.x | sudo -E bash -
apt-get install -y nodejs
- 建议win和Linux(服务器)使用统一的版本,环境,不然可能会出现打包失败
使用
- 查看版本
node -v
npm -v
- 下载包/运行/打包
npm install
npm run serve
npm run build
服务器使用
- 克隆项目
git clone 【地址】
- 移除node_modules dist
rm -r ./node_modules
rm -r ./dist
- 更新
git pull
- 启动
npm install
npm run build
# 使用nginx 作为web容器
nginx -s reload