yarn安装vue/cli后无法在命令行通过vue执行命令的解决方法

本文最后更新于:2022年5月4日 晚上

前言

根据vue官方文档,可以通过以下命令安装vue脚手架

1
yarn global add @vue/cli

但是在安装好后,不能通过vue执行命令

解决

检查安装时的用户是否为root
1.删除此前安装的vue

1
yarn global remove @vue/cli

2.用超级用户重新安装

1
sudo yarn global add @vue/cli

3.执行命令启动

1
vue

Ref

1.Command not found with vue-cli.(https://stackoverflow.com/questions/51172064/command-not-found-with-vue-cli)