一种方法是使用 node 版本管理器NVM.
使用以下命令获取nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
你可以在https://github.com/creationix/nvm找到它
它允许您轻松安装和管理多个版本的node.以下是帮助中的一个片段:
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)