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)

相關文章
相關標籤/搜索