本文仅仅是简单地介绍如何在Ubuntu/Debian系统上安装Node.js(任何版本)和npm(Node Package Manager的简写),其他类Linux系统安装步骤和这个类似。
一、更新系统
sudo apt-get update
sudo apt-get install git-core curl build-essential openssl libssl-dev
二、安装Node.js
git clone https://github.com/joyent/node.git
cd node
git tag # 这个命令将会显示Node的所有版本的列表
git checkout v0.12.7
./configure
make && make install
node -v #查看版本
三、安装NPM
wget https://npmjs.org/install.sh --no-check-certificate
chmod 777 install.sh
./install.sh
npm -v