首先安裝homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
開始安裝
安裝homebrew.png
安裝成功后
homebrew成功.png
安裝nodejs
brew install nodejs
安裝nodejs.png
安裝cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
安裝cnpm.png
這里如果報錯,就在命令前寫上sudo 設定權限
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
安裝webpack
cnpm install webpack -g
安裝webpack.png
如果這里報錯,同樣在命令行之前寫上sudo 設定權限
創建我們的工程
首先在桌面創建一個文件夾(first)
然后cd進這個文件夾:
cd /Users/liuking/Desktop/first
再執行
vue init webpack first
創建vue工程.png
再執行
cnpm install
創建vue工程.png
最后
cnpm run dev
大功告成.png