ubuntu安装nvm简易版

  1. Open a terminal and run the following command to install the required packages:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
  1. Then, run the following command to download and install nvm:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash

This will download the nvm installation script and run it.

  1. Once the installation is complete, you’ll need to add the following line to your shell configuration file (e.g. ~/.bashrc or ~/.zshrc) to enable nvm:
source ~/.nvm/nvm.sh
  1. Reload your shell configuration file by running:
source ~/.bashrc

(or source ~/.zshrc if you’re using zsh)

  1. Verify that nvm is installed by running:
nvm --version

This should display the version of nvm that you just installed.

That’s it! You should now be able to use nvm to manage multiple versions of Node.js on your Ubuntu system.

Note: If you’re using a newer version of Ubuntu, you may need to use the curl command with the -s flag to suppress the progress meter, like this:

curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
### 安装 Node.js 和 Git 的方法 #### Windows 操作系统的安装过程 对于希望在Windows操作系统上安装Node.js的情况,应先访问官方网站并下载适用于64位操作系统的Windows Installer(.msi)[^2]。完成下载之后,按照提示逐步执行安装程序即可。 为了确认Node.js及其包管理工具npm已经正确安装,在命令提示符或者PowerShell中分别键入`node -v`以及`npm -v`来获取两者各自版本号作为验证手段[^3]。 至于Git的安装,则建议前往官方站点寻找对应平台的最新稳定版安装文件。通常情况下,遵循默认选项推进安装向导就足以满足大多数开发者的日常需求。一旦安装完毕,同样可以在命令行界面通过`git --version`指令测试是否部署无误。 ```bash # 验证Node.js和npm安装情况 $ node -v $ npm -v # 测试Git安装状况 $ git --version ``` #### Linux 或 macOS 操作系统的简易指南 针对Linux发行版或是macOS用户而言,利用各系统自带的软件包管理系统可能是更为便捷的选择之一。例如Ubuntu/Debian系列可以借助apt-get;而CentOS/RHEL则可能更倾向于yum来进行Node.js与Git的一键式安装配置工作。不过具体命令会依据不同版本有所变化,请参照相应文档说明。 对于Node.js来说,除了上述方式外还有nvm(Node Version Manager)可供选用,它允许在同一台机器上面轻松切换多个不同的Node环境实例,非常适合那些需要频繁调整依赖关系的应用场景。 ```bash # 使用 apt-get (适用于 Debian, Ubuntu) sudo apt update && sudo apt install nodejs npm git # 使用 yum (适用于 CentOS, RHEL) sudo yum install epel-release sudo yum install nodejs npm git # 利用 nvm 安装特定版本的 Node.js curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash source ~/.bashrc nvm install --lts ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值