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
    评论
要在Ubuntu安装和使用nvm,您可以按照以下步骤进行操作: 1. 首先,更新您的软件包列表并安装必要的依赖项: ``` sudo apt-get update sudo apt-get install build-essential libssl-dev ``` 2. 安装nvm的脚本。您可以使用curl或wget来执行此操作。以下是两种方法: - 使用curl: ``` curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash ``` - 使用wget: ``` wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash ``` 3. 安装完成后,在终端运行以下命令检查nvm是否安装成功: ``` nvm --version ``` 4. 您还可以使用以下命令来查看远程版本、安装特定版本、切换版本和查看已安装的版本: - 查看远程版本: ``` nvm ls-remote ``` - 安装特定版本(例如10.9.0): ``` nvm install 10.9.0 ``` - 切换版本(例如切换到10.9.0): ``` nvm use 10.9.0 ``` - 查看已安装的版本: ``` nvm ls ``` 请注意,为了使更改生效,您可能需要重新启动终端。 希望这些步骤能够帮助您在Ubuntu上成功安装和使用nvm。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [ubuntu安装并使用nvm管理node版本](https://blog.csdn.net/shidaping/article/details/52218278)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* [Ubuntu 安装 nvm](https://blog.csdn.net/geol200709/article/details/82117103)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值