安装bash自动换行复制npm i -g n 为什么使用 n 切换版本无效n 的安装路径和 node 默认路径不一致查看 node 安装路径shell自动换行复制which node 编辑.bash_profile文件shell自动换行复制vim ~/.bash_profile 在该文件中添加text自动换行复制export N_PREFIX=/usr/local/bin/node #根据你的安装路径而定 export PATH=$N_PREFIX/bin:$PATH 保存并刷新文件shell自动换行复制source ~/.bash_profile 重新安装 nshell自动换行复制n stable 这次就可以切换版本了,但是需要授予 sudo 权限shell自动换行复制sudo n 参考文章n 模块切换 node 版本无效的解决办法
评论区
评论加载中...