nvm环境配置

时间:2023-12-15 17:08:20

安装nvm

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
nvm install stable
npm install -g yarn

加速shell启动,code ~/.profile

export NVM_DIR="$HOME/.nvm"
nvm() {
echo "Lazy loading nvm..."
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm
}
# 加入路径以后,node命令可以直接用
# 默认路径可以通过 nvm which default 获取
export PATH=$HOME/.nvm/versions/node/v12.3.1/bin/:$PATH

设置镜像

npm config set registry https://registry.npm.taobao.org
npm config set disturl https://npm.taobao.org/mirrors/node yarn config set registry https://registry.npm.taobao.org

code ~/.profile

export ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/