安装nvm 报错curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

需要在在不同项目中使用不同的node版本时,可以使用nvm管理

  • 1.卸载node
    卸载之前安装的node,使用nvm重新install node版本进行管理
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
  • 2 打开终端执行以下命令
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

报错

stall.sh | bash
Password:
Sorry, try again.
Password:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused

在这里插入图片描述

解决方法
修改hosts文件

  1. 打开网站: https://www.ipaddress.com/
    查询一下 raw.githubusercontent.com对应的IP 地址
    在这里插入图片描述
  2. 替换系统的hosts文件
    快捷键 shift + cmd +G
    在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

然后再运行

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

成功

在这里插入图片描述

引用\[1\]:根据引用\[1\]中的内容,你可以使用以下命令来安装或更新nvm: ``` wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh > nvm_install.sh sudo ./nvm_install.sh ``` 引用\[2\]:根据引用\[2\]中的内容,你也可以使用以下命令来安装或更新nvm: ``` curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash ``` 引用\[3\]:根据引用\[3\]中的内容,如果你在执行安装脚本时遇到了问题,可以尝试手动运行`git fetch`命令来更新nvm。具体步骤如下: ``` cd ~/.nvm git fetch ``` 问题:Failed to download 'https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/nvm.sh' 回答: 如果在下载 'https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/nvm.sh' 时出现错误,可能是由于网络连接问题导致的。你可以尝试重新运行下载命令,或者检查你的网络连接是否正常。如果问题仍然存在,你可以尝试使用其他下载方式,比如使用cURL命令或者手动下载脚本并运行。 #### 引用[.reference_title] - *1* [nvm 多版本node切换](https://blog.csdn.net/fareast_mzh/article/details/93620010)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [安装nvm遇到的天坑](https://blog.csdn.net/weixin_43254015/article/details/131436602)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值