部署(6.前端项目)

安稳与你 提交于 2020-01-23 18:58:25

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;
  }
}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!