基于 官方命令行工具 创建项目
全局安装命令行工具
# 全局安装 vue-cli
$ npm install --global vue-cli
安装到位置:
/home/xxxx/.npm/vue-cli/2.8.2/package/package.json
/opt/node-v6.11.1-linux-x64/lib/node_modules/vue-cli (bin lib等)
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
- ? Project name my-project-webpack
- ? Project description A Vue.js project
- ? Author hcj
- ? Vue build standalone
- ? Install vue-router? Yes
- ? Use ESLint to lint your code? Yes
- ? Pick an ESLint preset Standard
- ? Setup unit tests with Karma + Mocha? Yes
- ? Setup e2e tests with Nightwatch? Yes
- vue-cli · Generated "my-project-webpack".
- To get started:
-
- cd my-project-webpack
- npm install
- npm run dev
-
- Documentation can be found at https://vuejs-templates.github.io/webpack
复制代码# 安装依赖
$ cd my-project
$ npm install
$ npm run dev