部署(6.前端项目)

1.安装node、npm、cnpm

apt install nodejs
y
apt install npm
y
node -v
npm -v

npm install cnpm -g --registry=HTTPS://registry.npm.taobao.org;
cnpm -v

2.安装依赖

cd demo
cnpm install

3.将路由模式改成history模式:

vim src/router/index.js

4.打包

npm run build

5.配置Nginx

#加入配置
server{
  listen 80;
  server_name 49.234.49.146;
  location / {
    root /home/ubuntu/demo/dist;
    index index.html;
  }
}

猜你喜欢

转载自www.cnblogs.com/xuepangzi/p/12230941.html