当前位置:   article > 正文

macOS 上使用 brew 安装 NVM 管理 node.js,解决nvm: command not found_to remove, delete, or uninstall nvm - just remove

to remove, delete, or uninstall nvm - just remove the `$nvm_dir` folder (usu

前言

node.js 使用 nvm 进行版本管理,比较方便,记录一下使用 brew 在 macOS 上的安装步骤。

mac安装nvm需要配置环境,这就不会出现 -bash: nvm: command not found

环境说明

macOS 10.15

  1. % sw_vers
  2. ProductName: Mac OS X
  3. ProductVersion: 10.15.6
  4. BuildVersion: 19G73

Brew

  1. % brew --version
  2. Homebrew 2.4.8
  3. Homebrew/homebrew-core (git revision 820df; last commit 2020-07-27)
  4. Homebrew/homebrew-cask (git revision 35ad13; last commit 2020-07-28)

安装

安装 nvm

使用 brew 安装比较方便,更新一下 Homebrew 并安装

  1. % brew update
  2. % brew install nvm
  3. ...
  4. ...
  5. ...
  6. You should create NVM's working directory if it doesn't exist:
  7. mkdir ~/.nvm
  8. Add the following to ~/.zshrc or your desired shell
  9. configuration file:
  10. export NVM_DIR="$HOME/.nvm"
  11. [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
  12. [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
  13. You can set $NVM_DIR to any location, but leaving it unchanged from
  14. /usr/local/opt/nvm will destroy any nvm-installed Node installations
  15. upon upgrade/reinstall.
  16. Type `nvm help` for further information.
  17. Bash completion has been installed to:
  18. /usr/local/etc/bash_completion.d
  19. ==> Summary
  20. 声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/310668
    推荐阅读
    相关标签