Mac安裝vuehtml
1、安裝brew
打開終端運行如下命令:vue
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
配置brew環境變量node
Taojie:~ apple$ open .bash_profile Taojie:~ apple$ source .bash_profile
添加brew路徑以下:webpack
裝成功後,查看一下brew的版本信息:git
Taojie:~ apple$ brew -v Homebrew 2.1.4 Homebrew/homebrew-core (git revision 5c8b; last commit 2019-06-10) Taojie:~ apple$
2、安裝node.jsgithub
在終端中運行如下命令:web
Taojie:~ apple$ brew install nodejs
安裝成功後,查看一下node.js的版本信息:vue-router
Taojie:~ apple$ node -v v12.4.0 Taojie:~ apple$
三、獲取nodejs模塊安裝目錄訪問權限vue-cli
Taojie:~ apple$ sudo chmod -R 777 /usr/local/lib/node_modules/ Password: Taojie:~ apple$
四、安裝 淘寶鏡像 (npm)npm
Taojie:~ apple$ npm install -g cnpm --registry=https://registry.npm.taobao.org
五、安裝webpack
Taojie:~ apple$ cnpm install webpack -g
六、安裝vue腳手架
Taojie:~ apple$ cnpm install vue-cli -g
七、在硬盤上找一個文件夾放工程用的,在終端中進入該目錄
Taojie:~ apple$ cd /TJT/vue Taojie:vue apple$ ls Taojie:vue apple$
八、根據模板建立項目
Taojie:vue apple$ vue init webpack-simple vue1
Taojie:vue apple$ cd vue1
Taojie:vue1 apple$
九、安裝項目依賴
Taojie:vue1 apple$ cnpm install
十、安裝 vue 路由模塊vue-router和網絡請求模塊vue-resource
Taojie:vue1 apple$ cnpm install vue-router vue-resource --save
十一、啓動項目
Taojie:vue1 apple$ npm run dev
安裝OK後,訪問http://localhost:8080以下:
3、在webStorm中啓動vue項目:
一、Run In Terminal
二、在終端輸入啓動命令 npm run dev
Taojie:src apple$ npm run dev
> vue1@1.0.0 dev /TJT/vue/vue1
> cross-env NODE_ENV=development webpack-dev-server --open --hot
Project is running at http://localhost:8081/
webpack output is served from /dist/
404s will fallback to /index.html
{ parser: "babylon" } is deprecated; we now treat it as { parser: "babel" }.
Windows下安裝vue: