首先全局安装yarn

npm install yarn -g

设置yarn的下载源为淘宝镜像

yarn config set registry https://registry.npmmirror.com/
yarn config set disturl https://npmmirror.com/dist
yarn config set electron_mirror https://npmmirror.com/mirrors/electron/
yarn config set sass-binary-site https://npmmirror.com/mirrors/node-sass/
官方镜像地址: https://registry.yarnpkg.com

清理缓存

yarn cache clean

设置npm的下载源为淘宝镜像

npm config set registry https://registry.npmmirror.com/

清理缓存

npm cache clean -f

查看镜像是否切设置成功

yarn config get registry

全局安装vue-cli脚手架

yarn global add @vue/cli

查看是否安装成功

vue -V 如果命令行有提示相应的版本信息则安装成功

创建脚手架项目

  • 在需要开发项目的路径下打开命令行工具
    vue create 项目名称 就会自动创建一个项目文件夹

如果windows系统的命令行工具提示

yarn : 无法加载文件 C:\Users\xiaochaoren\AppData\Roaming\npm\yarn.ps1,因为在此系统上禁止运行脚本。有关详细信息

使用下面命令解决(以管理员身份运行 terminal 或者 Powershell)

set-executionpolicy remotesigned
Logo

前往低代码交流专区

更多推荐