温馨提示×

debian能否运行node js

小樊
38
2026-10-17 00:19:57
栏目: 编程语言

可以的,Debian 完全可以运行 Node.js。

常见安装方式

1. 使用 Debian 官方仓库(简单但版本可能较旧)

sudo apt update
sudo apt install nodejs npm

查看版本:

node --version
npm --version

2. 使用 NodeSource(推荐,版本较新)

例如安装 Node.js 20:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

3. 使用 NVM(适合开发,可管理多版本)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --lts

运行示例

node -e "console.log('Hello Debian')"

说明

  • Debian 11 / 12 都支持 Node.js
  • 服务器、桌面版均可运行
  • 可用于 Web 服务、脚本、工具开发等

如果你有 特定 Debian 版本 或 使用场景(如服务器部署),我可以给更具体的建议。

0 踩