当我们执行npm install -g @vue-cli时候会报错:
npm ERR! Invalid tag name “@vue-cli” of package “@vue-cli”: Tags may not have any characters that encodeURIComponent encodes.
npm ERR! A complete log of this run can be found in: /Users/wuwenlu/.npm/_logs/2023-07-30T12_30_33_993Z-debug-0.log
在这里插入图片描述
仔细检查我们输入的命令,有误
应该是

npm install -g @vue/cli

再次报错:

npm install -g @vue/cli 
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/@vue
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/@vue'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /Users/wuwenlu/.npm/_logs/2023-07-30T23_37_52_775Z-debug-0.log

在这里插入图片描述
再次用管理员输入该命令,发现成功了

sudo npm install -g @vue/cli

验证是否成功安装:

npm list -g

在这里插入图片描述

Logo

前往低代码交流专区

更多推荐