vue-cli建立项目

1.npm

在用 Vue 构建大型应用时推荐使用 NPM 安装(对于中国大陆用户,建议将 NPM 源设置为国内的镜像,即cnpm, 命令:html

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

能够大幅提高安装速度)vue

npm升级到最新版本:node

cnpm install npm -g

2.安装Vue

# 最新稳定版
$ npm install vue

3.安装vue-cli

npm install vue-cli -g(全局)webpack

全局卸载vue-cli:npm uninstall vue-cli -gweb

4.初始化(建立)基于vue的项目

vue init webpack webvue-router

基于webpack来构建一个名称为web的vue项目vue-cli

后面以此会出现选择:npm

Project Description:项目简介,也会出如今package.json文件中,可选json

Author:做者,可选bash

Install vue-router:是否安装vue路由组件,作项目的话必定要安装(这一步y,其余均可以直接回车)

Use ESLint to lint your code:是否须要使用ESLint模块进行代码检测

Setup unit tests with Karma + Mocha?:是否安装测试(单元测试)

Setup e2e tests with Nightwatch?:是否安装端到端的测试

5.运行

npm run dev:开启一个测试开发环境
npm run build : 构建项目,把项目进行打包,咱们能够把项目打包后的文件上传到服务器

若是是首次运行,那么会看到一个欢迎页面,下面咱们就能够进行项目开发

参考:http://www.javashuo.com/article/p-gzxhwnve-cd.html

 

环境配置:

node --version

(8.9.9)

 

http://www.javashuo.com/article/p-eknuhfkh-n.html

 

gcc升级(5.4.0, 必须4.80+)

http://www.cnblogs.com/lpbottle/p/install_gcc.html

http://www.javashuo.com/article/p-xgftsrwe-db.html

 

npm --version

(5.8.0)

 

vue --version

(2.9.3)

相关文章
相关标签/搜索