vue-cli项目生成

安装vue-cli

C:\Users\fei>npm install -g vue-cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coff
eescript" (no hyphen)
D:\nodes\node_cache\vue-init -> D:\nodes\node_cache\node_modules\vue-cli\bin\vue
-init
D:\nodes\node_cache\vue -> D:\nodes\node_cache\node_modules\vue-cli\bin\vue
D:\nodes\node_cache\vue-list -> D:\nodes\node_cache\node_modules\vue-cli\bin\vue
-list
+ vue-cli@2.9.6
added 239 packages in 79.481s

相关命令

  查看版本信息和帮助信息

C:\Users\fei>vue -V
2.9.6

C:\Users\fei>vue --help
Usage: vue <command> [options]

Options:
  -V, --version  output the version number
  -h, --help     output usage information

Commands:
  init           generate a new project from a template
  list           list available official templates
  build          prototype a new project
  create         (for v3 warning only)
  help [cmd]     display help for [cmd]

  查看模板信息

C:\Users\fei>vue list

  Available official templates:

  ★  browserify - A full-featured Browserify + vueify setup with hot-reload, li
nting & unit testing.
  ★  browserify-simple - A simple Browserify + vueify setup for quick prototypi
ng.
  ★  pwa - PWA template for vue-cli based on the webpack template
  ★  simple - The simplest possible Vue setup in a single HTML file
  ★  webpack - A full-featured Webpack + vue-loader setup with hot reload, lint
ing, testing & css extraction.
  ★  webpack-simple - A simple Webpack + vue-loader setup for quick prototyping
.
# 切换到指定目录

C:\Users\fei>cd E:\前端\vue\vue学习\第一个vue-cli项目

C:\Users\fei>e:

E:\前端\vue\vue学习\第一个vue-cli项目>

  项目生成

E:\前端\vue\vue学习\第一个vue-cli项目>vue init webpack-simple myProject

? Project name 01
? Project description A Vue.js project
? Author 张亚飞 <1271570224@qq.com>
? License MIT
? Use sass? No

   vue-cli · Generated "myProject".

   To get started:

     cd myProject
     npm install
     npm run dev 

 如果报错

> cross-env NODE_ENV=development webpack-dev-server --open --hot

'webpack-dev-server' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
events.js:167
      throw er; // Unhandled 'error' event
      ^

解决方案

npm install webpack-cli@3.0.0 -g 

vue开源项目汇总

https://github.com/opendigg/awesome-github-vue

  

posted @ 2019-01-16 12:42  DreamBoy_张亚飞  阅读(507)  评论(0编辑  收藏  举报