Mac下Fish解决nvm安装问题

457 阅读1分钟

最近需要管理node版本号,在终端安装nvm遇到以下报错信息:

主要原因

NVM in fish · Issue #303 · nvm-sh/nvm · GitHub

May I request that this issue be reformatted in the form of a bug?NVM does not install if you use the fish shell.NVM does not work in the fish shell shell shell if previously installed in the bash shell. In fact, nvm isn't even in the path.

解决办法

function nvm
      bass source ~/.nvm/nvm.sh ';' nvm $argv
end

具体操作

第一步 fish安装oh-my-fish

curl -L https://get.oh-my.fish | fish

检查

omf -vOh My Fish version 7

第二步下载bass

omf install bass

第三步配置nvm

cd ~/.config/fish
vim config.fish

添加如下配置

function nvm
    bass source ~/.nvm/nvm.sh ';' nvm $argv
end

生效配置

source ~/.config/fish/config.fish

第四步检查

nvm -v