1.安装npm
下载地址:http://nodejs.cn/download/
2.安装脚手架(vue-cli)
npm install vue-cli -g
验证是否安装成功(vue -V)
3.初始化项目
vue init
template-name:模板名称(vue-cli提供了五种) 常用webpack
project-name:项目名称
eg:vue init webpack vue-test
输入命令后的配置
Project name :不能输入大写字母
Project description:项目描述
Author:作者
Install vue-router? 是否安装vue的路由插件 Y
Use ESLint to lint your code? 是否用ESLint来限制你的代码错误和风格
setup unit tests with Karma + Mocha? 是否需要安装单元测试工具Karma+Mocha n
Setup e2e tests with Nightwatch?是否安装e2e来进行用户行为模拟测试 n
cd vue-test
npm install (安装依赖包)
npm run dev (运行)
直接运行会报错(vue{ parser: “babylon” } is deprecated; we now treat it as { parser: “babel” }.)
因为prettier版本的问题,
解决方案:
npm install prettier@~1.12.0 -D
4.安装less-loader
npm install less less-loader --save-dev