Ubuntu nvm安装笔记

nvm github
https://github.com/creationix

  1. 安装Git
sudo apt-get install git
  1. 安装NVM
cd ~/

git clone https://github.com/nvm-sh/nvm.git .nvm

cd ~/.nvm

. ./nvm.sh
  1. 配置 ~/.bashrc, ~/.profile, ~/.zshrc(最好都配置一遍)
sudo gedit ~/.bashrc

最后一行粘贴一下内容

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

更新配置(或者重启一下)

source ~/.bashrc
  1. 检查NVM是否安装成功
nvm --version
  1. 修改nvm源
cd ~/.nvm

sudo gedit nvm.sh

搜索 NVM_NODEJS_ORG_MIRROR, 修改网址为 https://npm.taobao.org/mirrors/node/

source ~/.nvm/nvm.sh
  1. 修改npm源
npm config set registry https://registry.npm.taobao.org/

你可能感兴趣的:(Ubuntu nvm安装笔记)