Ubuntu20.04安装nvm

root@parallels-Parallels-Virtual-Platform:/tmp# curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
  % 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: (35) OpenSSL SSL_connect: 连接被对方重设 in connection to raw.githubusercontent.com:443 

 

成功处理的方案(通过修改hosts解决此问题的办法)

  1. 在 www.ipaddress.com 查询 raw.githubusercontent.com 的真实为IP 185.199.108.133 (以实际为准)
  2. sudo vi /etc/hosts
  3. 185.199.108.133     raw.githubusercontent.com
  4. wq
  5. curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
  6. 成功

 

成功示例

root@parallels-Parallels-Virtual-Platform:/tmp# curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7750  100  7750    0     0   4574      0  0:00:01  0:00:01 --:--:--  4572
=> Downloading nvm from git to '/root/.nvm'
=> 正克隆到 '/root/.nvm'...
fatal: 无法访问 'https://github.com/creationix/nvm.git/':Failed to connect to github.com port 443: 拒绝连接
fatal: 不是 git 仓库(或者任何父目录):.git
fatal: 不是 git 仓库(或者任何父目录):.git

=> Appending source string to /root/.bashrc
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

/usr/local/lib
└── yarn@1.22.10

=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm

 

关闭终端 重新打开

 

 

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐