今天在安装mac m2的vuecli时候报错,报错大致如下
changed 854 packages in 26s 74 packages are looking for funding run npm fund for details gujiawei@Jia-Weis-MacBook-Air ~ % vue -v node:internal/modules/cjs/loader:927 throw err; ^ Error: Cannot find module '/usr/local/lib/node_modules/vue-cli/bin/vue' at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15) at Function.Module._load (node:internal/modules/cjs/loader:769:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47 { code: 'MODULE_NOT_FOUND', requireStack: []
解决办法:先进入/user/local/lib然后删除node_modules文件夹
cd /usr/local/lib sudo rm -rf node_modules
然后然后上一层
sudo rm -rf node_modules package*
进入bin
cd bin sudo rm -rf vue* webpack*
可能用到的命令
nano ~/.zshrc #环境变量 ls -la #列出当前目录下的所有文件和子目录