背景  : win10

    使用  yarn  全局 安装  vue/cli 后   yarn  global add  @vue/cli

    提示安装成功

    使用vue create   提示  bash: vue command not found

 

经过一番搜索。。。。。。原来是 环境变量的问题

首先找到yarn  全局安装vue的路径  : 应该和我的类似, 我的路径是   C:\Users\卡莱特(深圳)云科技有限公司\AppData\Local\Yarn\Data\global\node_modules\.bin

然后右键我的电脑 =>  属性 =》高级系统设置=》 高级 =》 环境变量 =》 系统变量 =》  Path  

解决  bash: vue command not found

把 上面的 vue 安装路径 黏贴 到 新建的path 中  , 确定   

重新打开命令行或者git bash  再输入 vue -V 

解决  bash: vue command not found

 

 Ok  完美解决

 

------------------------------------

macos vue command not found 解决办法

一番查找。。。。   各种折腾,最后 =====    原因是 :node的路径没有导出 

1.   编辑bash_profile

  vim bash_profile

  解决  bash: vue command not found

 

 2.  按i 进入编辑模式,添加一行 : 

export PATH=${PATH}:/usr/local/bin/node

解决  bash: vue command not found

 

 按esc,    输入:wq

3. 刷新配置: source bash_profile

4. 输入vue --version

解决  bash: vue command not found

 

5 安装了zsh的同学会发现重启终端后vue又找不到了,是因为终端开启时没有刷新bash_profile配置,而是刷新的zshrc的配置,

6 所以还要在 zshrc的配置里加上一行开启bash_profile, 

open -a xcode ~/.zshrc
在最后一行加上
source ~/bash_profile ~/.bashrc
然后重启终端

开始你的vue之旅吧

 

相关文章:

  • 2021-09-12
  • 2021-04-22
  • 2021-09-05
  • 2021-07-17
  • 2021-07-22
  • 2021-10-24
  • 2021-08-22
  • 2021-11-17
猜你喜欢
  • 2021-11-18
  • 2021-12-06
  • 2021-06-28
  • 2022-12-23
  • 2021-08-19
相关资源
相似解决方案