Node.js

Node.js

快速安装 Node.js 环境

Node Version Manager (nvm)

要安装或更新 nvm,应运行安装脚本。

为此,您可以手动下载并运行脚本,或使用以下 cURL 或 Wget 命令:

Latest Version: v0.39.7

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/version/install.sh | bash

运行上述任一命令都会下载并运行一个脚本。

脚本会将 nvm 仓库克隆到 ~/.nvm,并尝试将下面代码段中的源代码行添加到正确的配置文件(\~/.bash_profile\~/.zshrc\~/.profile\~/.bashrc)中。

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

然后,安装最新版本的Node.js,运行以下命令:

nvm install node