搭建vue前端项目

1. 确认安装nodejs

 2. 确认安装npm

 3. 国内npm下载依赖的速度太慢,淘宝镜像cnpm速度快,所以注册cnpm代替npm。

npm install cnpm -g --registry=https://registry.npm.taobao.org

 4. 安装vue-cli

cnpm install -g vue-cli

5. 初始化项目,打包工具选择webpack,项目名称:vue-test-ui

vue init webpack vue-test-ui

6. 接下来,填写一些信息,可以直接enter。

Project name 项目名
Project description 项目名描述
Author 作者邮箱
Use ESLint to lint your code? 是否需要ESlist语法检查
Setup unit tests with Karma + Mocha? 是否需要单元测试
Setup e2e tests with Nightwatch? Yes是否需要e2e测试

7. 这一项可以选择yes,也可以选择no。

 选择yes使用npm install命令安装,选择no,自行使用cnpm install命令安装。

8. 出现这个就可以启动项目了

 9. 启动项目

cnpm run dev

10. 访问项目http://localhost:8080/#/

11. 打包项目

cnpm run build

原文地址:https://www.cnblogs.com/liubingfei/p/12342048.html