由于使用apt工具直接安装node.js会出现问题,所以我们使用 n 来安装node.js
n 是一个node.js版本管理器
n的安装很简单,在命令行输入curl -L https://git.io/n-install | bash
n安装时默认会安装上好最新稳定版node.js。这样node.js和n就一次性安装好了
安装完成,输入. /root/.bashrc
,更新bash配置。
然后输入node -v
,查看你的node版本。出现版本信息,恭喜安装无误。
以下列出一些你可能遇到的问题:
-bash: curl: command not found
apt install curl
E: Unable to locate package curl
apt-get update //更新软件源
`git` not found
apt install git
GNU Make not found
apt-get install build-essential