终端输入:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
。开始安装,中间可能要输入电脑密码,耐心等待事后出现下图表示安装成功。可经过brew -v 查看版本。html
终端输入:brew install nodejs
或者直接官网手动安装。 node -v 查看 nodejs版本vue
注:网上说使用终端安装会须要nodejs模块安装目录的权限,运行:sudo chmod -R 777 /usr/local/lib/node_modules/node
终端输入:npm install -g cnpm --registry=https://registry.npm.taobao.org 配置镜像加速:npm config set registry https://registry.npm.taobao.org
cnpm install webpack -g
sudo npm install -g vue-cli
输入vue或者vue list,可vue是否安装成功。webpack
vue list
vue init webpack hello
npm install
npm run dev。关闭请按ctrl+c。
npm run build