本来用npm下载
npm install -g @vue/cli-service-global`
但是发生报错:npm ERR! code ERR_SOCKET_TIMEOUT
意思是安装超时了,所以采用cnpm下载
- 先安装cnpm
`npm install -g cnpm --registry=https://registry.npm.taobao.org`
- 然后下载
cnpm install -g @vue/cli
- 安装完后查看vue-cli版本
C:\Users\cc>vue -V
@vue/cli 4.5.10
- 创建项目
vue create xxx //xxx为项目名字
中间需要选择一些配置,我都是选择了default默认
创建成功
- 运行
npm run serve
参考 https://blog.csdn.net/mengxianglong123/article/details/102949138