直接 npm install -g @vue/cli全局安装是会出现错误
这种错误提示是你没有权限将安装文件直接写入一个权限控制文件里。
npm全局安装文件时可以使用 ‘sudo’ 任何管理员账户都可以使用sudo来获取 root 权限。
使用 sudo npm install -g @vue/cli 进行安装
1、输入安装命令后,命令提醒你输入Password密码,目的使用管理员权限去安装
Last login: Tue Oct 30 23:44:47 on ttys000asusdeMac:~ asus$ sudo npminstall-g @vue/cliWe trust you have received the usual lecturefromthelocalSystemAdministrator. It usually boils downtothese three things:#1) Respect the privacy of others.#2) Think before you type.#3) With great power comes great responsibility.Password:
密码输入完后稍等一会儿就安装成功啦!
asusdeMac:~ asus$ sudo npminstall-g @vue/clinpm WARN deprecatedcross-spawn-async@2.2.5:cross-spawnnolonger requires abuildtoolchain,useit instead/usr/local/bin/vue