macOS npm install 一直需要 sudo 权限的问题
开门见山,直接说解决方案
不要使用 Homebrew 安装 nvm,在nvm 官方文档中有提及:
Homebrew installation is not supported. If you have issues with homebrew-installed nvm
, please brew uninstall
it, and install it using the instructions below, before filing an issue.
使用官方提供的命令重新进行安装:
1 | curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash |
或者是:
1 | wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash |
错误类型
一般会提示 code EACCES npm ERR! syscall open 或者是没有 mkdir 权限,有类似报错内容的按照官方文档重新安装 nvm 即可修复
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Michael Li!