安裝nodejs 6,這是目前大可能是nodejs應用運行的依賴版本:node
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs
若是安裝 Node.js v7:linux
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - sudo apt-get install -y nodejs
更多操做系統的nodejs安裝方法:git
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributionsgithub
24 October 2011npm
This is just short snippet on how to install Node.js (any version) and NPM (Node Package Manager) on your Ubuntu/Debian system.ubuntu
sudo apt-get update sudo apt-get install git-core curl build-essential openssl libssl-dev
First, clone the Node.js repository:bash
git clone https://github.com/joyent/node.git cd node
Now, if you require a specific version of Node:curl
git tag # Gives you a list of released versions git checkout v0.4.12
Then compile and install Node like this:ui
./configure make sudo make install
Then, check if node was installed correctly:this
node -v
Simply run the NPM install script:
curl -L https://npmjs.org/install.sh | sudo sh
And then check it works:
npm -v
That’s all.