vue安装

1. 从node.js官网下载并安装node,安装过程很简单。 
C:\Users\yw>node -v
v8.9.4

#升级 npm,node自带的npm不是最新的。
cnpm install npm -g

C:\Users\yw>npm -v
5.6.0

3.基于node.js,利用淘宝npm镜像安装相关依赖。由于国内使用npm会很慢,这里推荐使用淘宝NPM镜像(http://npm.taobao.org/)
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
完成之后,我们就可以用cnpm代替npm来安装依赖包了。

C:\Users\yw>npm install -g cnpm --registry=https://registry.npm.taobao.org
C:\Users\yw\AppData\Roaming\npm\cnpm -> C:\Users\yw\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm
+ cnpm@5.2.0
added 778 packages in 209.733s

安装全局vue-cli脚手架,用于帮助搭建所需的模板框架

$ cnpm install -g vue-cli
# 回车,等待安装...
$ vue
# 回车,若出现vue信息说明表示成功
C:\Users\yw>vue -V
2.9.3

# 创建一个基于 webpack 模板的新项目
E:\gocode\vueproject>vue init webpack hcxy_car_update
 这里需要进行一些配置,默认回车即可
This will install Vue 2.x version of the template.
For Vue 1.x use: vue init webpack#1.0 my-project
? Project name my-project
? Project description A Vue.js project
? Author runoob <test@runoob.com>
? Vue build standalone
? 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".
   To get started:
     cd my-project
     npm install
     npm run dev
   Documentation can be found at https://vuejs-templates.github.io/webpack
   
五、安装依赖
在cmd里
1).输入:cd my-project(项目名),回车,进入到具体项目文件夹
2).输入:cnpm install,回车,等待一小会儿
回到项目文件夹,会发现项目结构里,多了一个node_modules文件夹(该文件里的内容就是之前安装的依赖)

六、测试环境是否搭建成功
方法1:在cmd里输入:npm run dev
方法2:在浏览里输入:localhost:8080(默认端口为8080)

sublime vue 语法高亮插件安装


# hcxy_car_update
> hcxy_car_update
## Build Setup
``` bash
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test

 以管理员权限运行cmd

posted @ 2018-03-05 21:07  无天666  阅读(389)  评论(0编辑  收藏  举报