这个文章用于记录我的 node 设置
# 安装 nvm
cd ~/
git clone https://github.com/nvm-sh/nvm.git .nvm
cd ~/.nvm
source ~/.nvm/nvm.sh
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
# 安装 node
nvm install 6
nvm use 16
node -v
# 使用 cnpm 代替 npm 命令
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
# 创建 global 文件夹
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=$PATH:$/.npm-global/bin