在 Debian 系统上查看 Node.js 版本,常用方法如下:
node -v
或
node --version
npm -v
说明可能没有安装 Node.js,或者不在 PATH 中。可以检查是否已安装:
which node
或
ls /usr/bin/node /usr/local/bin/node
dpkg -l | grep nodejs
或
apt list --installed | grep nodejs
如果你是用 nvm 安装的 Node.js:
nvm ls
如果你还没装 Node.js,可以用:
sudo apt update
sudo apt install nodejs npm
(Debian 仓库中的版本通常较旧,如需新版可使用 NodeSource 或 nvm)
需要我帮你装指定版本的 Node.js 吗?