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
   
5、安裝依賴
在cmd裏
1).輸入:cd my-project(項目名),回車,進入到具體項目文件夾
2).輸入:cnpm install,回車,等待一小會兒
回到項目文件夾,會發現項目結構裏,多了一個node_modules文件夾(該文件裏的內容就是以前安裝的依賴)

6、測試環境是否搭建成功
方法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

 以管理員權限運行cmdvue

相關文章
相關標籤/搜索