首先安装homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
开始安装

安装成功后

安装nodejs
brew install nodejs

安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org

这里如果报错,就在命令前写上sudo 设定权限
sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
安装webpack
cnpm install webpack -g

如果这里报错,同样在命令行之前写上sudo 设定权限
创建我们的工程
首先在桌面创建一个文件夹(first)
然后cd进这个文件夹:
cd /Users/liuking/Desktop/first
再执行
vue init webpack first

再执行
cnpm install

最后
cnpm run dev

网友评论