nvm在ubuntu中本地安装

不要再改host了,改host只是改了DNS,不代表你能连上那个IP。

其实nvm的github中说的很清楚了,可以使用git方式安装:


Git Install

If you have git installed (requires git v1.7.10+):

  1. clone this repo in the root of your user profile
  • cd ~/ from anywhere then git clone https://github.com/nvm-sh/nvm.git .nvm
  1. cd ~/.nvm and check out the latest version with git checkout v0.39.0
  2. activate nvm by sourcing it from your shell: . ./nvm.sh

Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)

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

如果直接从github太慢的话,可以先在gitee上注册一个账户,然后登录gitee并选择”从Github导入仓库“。

然后用下面的命令拉到ubuntu的home下:

cd ~
git clone https://gitee.com/[你的gitee仓库链接].git .nvm

添加taobao镜像:
参考:https://www.jianshu.com/p/dbc4db1eb608

echo -e "\nexport NVM_NODEJS_ORG_MIRROR=http://npm.taobao.org/mirrors/node" >> ~/.bashrc
source ~/.bashrc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值