JavaScript 使用指南
Node.js 使用指南
使用 apt
安装 Node.js
sudo apt-get update
sudo apt-get install -y nodejs npm
检查是否安装成功。
$ node -v
v18.13.0
$ npm -v
9.2.0
Bianbu 源中的 Node.js 默认版本为 v18.13.0,若想使用特定版本的 Node.js,请使用 NVM 安装。
使用 NVM 安装特定版本 Node.js
安装 NVM
根据 https://github.com/nvm-sh/nvm 提供的命令行下载并执行安装脚本,请根据该仓库替换最新的 NVM 版本号。
使用 curl
:
sudo apt install curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
或使用 wget
:
sudo apt install wget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash