一,安装brew(Windows可省略)
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
二,安装Node
去官网下载安装包即可 下载 | Node.js 中文网
http://nodejs.cn/download/
老版本 Index of /download/release/ (nodejs.org)
https://origin.nodejs.org/download/release/
之后更新Node版本 npm install -g npm
查看Node版本 显示版本号安装成功
node -v
三,安装yarn
之后更新yarn版本 npm install yarn@latest -g
npm install -g yarn
查看版本号
yarn -v
四,安装淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
查看版本号
cnpm -v
如果报错 certificate has expired
// 1. 清空缓存
npm cache clean --force
// 2. 关闭SSL验证
npm config set strict-ssl false
再执行
npm install -g cnpm --registry=https://registry.npm.taobao.org
五,用cnpm安装vue脚手架
之后更新脚手架版本 npm update -g @vue/cli
cnpm install -g vue-cli
查看版本号
vue -V
六,搭建项目
vue create 项目名
vue create vuecli-demo