Nodejs教程-在Linux/Ubuntu/CentOS上安装Node.js

我们可以轻松地在Linux/Ubuntu/CentOS/Fedora/LinuxMint等系统上安装Node.js。要在Linux(Ubuntu)操作系统上安装Node.js,请按照以下说明进行操作:
- 打开Ubuntu终端(您可以使用快捷键Ctrl+Alt+T)。
- 输入命令 sudo apt-get install python-software-properties
- 按Enter键(如果您已经为系统设置了密码,则会要求输入密码)。
- 输入密码并按Enter键。
- 输入命令 sudo apt-add-repository ppa:chris-lea/node.js
- 按Enter键。
- 再次按Enter键继续。
- 输入命令 sudo apt-get update(等待一段时间)。
- 输入命令 sudo apt-get install nodejs npm
- 输入命令 sudo apt-get install nodejs
安装完成。现在可以通过 node --version 命令检查Node的版本。
通过 npm -v 命令检查npm的版本。
现在,您可以通过输入以下命令在已安装的程序列表中检查node.js
dpkg --get-selections