1.安装node、npm、cnpm

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

部署(6.前端项目)

 

 

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

 

2.安装依赖

cd demo
cnpm install

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

部署(6.前端项目)

 

 

部署(6.前端项目)

 

 

vim src/router/index.js

4.打包

部署(6.前端项目)

npm run build

5.配置Nginx

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

部署(6.前端项目)

相关文章: