Mac创建vue-cli报错

1. 创建脚手架

- 输入命令:npm install -g @vue/cli --force  

- 出现以下报错:

npm WARN using --force Recommended protections disabled.

npm ERR! code EEXIST

npm ERR! syscall mkdir

npm ERR! path /Users/josie/.npm/_cacache/content-v2/sha512/58/8c

npm ERR! errno EEXIST

npm ERR! Invalid response body while trying to fetch https://registry.npmmirror.com/open: EACCES: permission denied, mkdir '/Users/josie/.npm/_cacache/content-v2/sha512/58/8c'

npm ERR! File exists: /Users/josie/.npm/_cacache/content-v2/sha512/58/8c

npm ERR! Remove the existing file and try again, or run npm

npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in: /Users/josie/.npm/_logs/2023-10-11T13_55_00_769Z-debug-0.log

- 检查vue版本:

josie@192 项目 % vue -V

zsh: command not found: vue

2. 重新安装脚手架

 - 输入命令

sudo npm install -g vue-cli
Password:

npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli

npm WARN deprecated har-validator@5.1.5: this library is no longer supported

npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated consolidate@0.14.5: Please upgrade to consolidate v1.0.0+ as it has been modernized with several long-awaited fixes implemented. Maintenance is supported by Forward Email at https://forwardemail.net ; follow/watch https://github.com/ladjs/consolidate for updates and release changelog

npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)

added 234 packages in 3s

3.查看帮助

josie@192 项目 % vue -help

Usage: vue <command> [options]

Options:

  -V, --version  output the version number

  -h, --help     output usage information

Commands:

  init           generate a new project from a template

  list           list available official templates

  build          prototype a new project

  create         (for v3 warning only)

  help [cmd]     display help for [cmd]

josie@192 项目 % vue  -V

2.9.6

4.更新vue版本

-Vue-cli更新版本,需要先把旧的版本进行卸载,输入npm uninstall -g vue-cli

此时会出现卸载失败的情况,也就是查看版本的时候,版本还是原来的版本

-解决方法:找到原来安装vue的目录 

which Vue

目录: 

/usr/local/bin/Vue

打开命令终端,进入到这个目录中

cd /usr/local/bin

输入删除命令

sudo rm -rf vue vue-init
Password:

此时我们再查看的时候,命令终端会提示
command not found : vue

josie@192 bin % vue -V
zsh: command not found: vue


此时将可以进行下载新的版本vue-cli

sudo npm install -g @vue/cli

下载成功后查看版本

josie@192 bin % vue -V
@vue/cli 5.0.8

-可能会出现的问题:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值