操作
-- 下载nvm安装脚本
wget -c -O nvm-install.sh https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh
-- 将nvm-install.sh中的下载链接前添加 https://ghproxy/
安装nvm
bash nvm-install.sh
# 重新加载 ~/.bashrc, 使nvm命令可用
source ~/.bashrc
# 设置nodejs国内源
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node/
# 安装nodejs
nvm install --lts
nvm-install.sh
修改Diff
@@ -59,14 +59,14 @@ nvm_source() {
local NVM_SOURCE_URL
NVM_SOURCE_URL="$NVM_SOURCE"
if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
- NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm-exec"
+ NVM_SOURCE_URL="https://ghproxy.com/https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm-exec"
elif [ "_$NVM_METHOD" = "_script-nvm-bash-completion" ]; then
- NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/bash_completion"
+ NVM_SOURCE_URL="https://ghproxy.com/https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/bash_completion"
elif [ -z "$NVM_SOURCE_URL" ]; then
if [ "_$NVM_METHOD" = "_script" ]; then
- NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm.sh"
+ NVM_SOURCE_URL="https://ghproxy.com/https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm.sh"
elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
- NVM_SOURCE_URL="https://github.com/${NVM_GITHUB_REPO}.git"
+ NVM_SOURCE_URL="https://ghproxy.com/https://github.com/${NVM_GITHUB_REPO}.git"
else
nvm_echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
return 1
评论 (0)