ubuntu安装node.js
2014-05-25 00:10
316 查看
How
to install the latest node.js on Ubuntu?
Node.js is an event-based and non-blocking I/O framework — built on Chrome’s JavaScript engine. Its goal is to provide an easy way to build scalable network programs.In most linux distributions Node.js is available in a repository which can be accessed via a package manager such as
apt-getor
aptitude.
However in the repository of the brand new Ubuntu 12.10 (Quantal Quetzal) the
nodejspackage
has the version number 0.6.19 while the current version is 0.8.14 as of this writing. Unfortunately many nodes — that’s how node.js applications are called — are constantly under development and often depend on a newer version.
If you are trying to install a node with the
node package managerbut providing an old node environment, you most probably expierence a similar error message to the one below.
npm ERR! error installing ws@0.4.22 npm WARN This failure might be due to the use of legacy binary "node" npm WARN For further explanations, please read npm WARN /usr/share/doc/nodejs/README.Debian npm WARN npm ERR! ws@0.4.22 install: `node install.js` npm ERR! `sh "-c" "node install.js"` failed with 127 npm ERR! npm ERR! Failed at the ws@0.4.22 install script. npm ERR! This is most likely a problem with the ws package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node install.js npm ERR! You can get their info via: npm ERR! npm owner ls ws npm ERR! There is likely additional logging output above. npm ERR! npm ERR! System Linux 3.5.0-17-generic npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "ws" npm ERR! cwd /home/slopjong/ npm ERR! node -v v0.6.19 npm ERR! npm -v 1.1.4 npm ERR! code ELIFECYCLE npm ERR! message ws@0.4.22 install: `node install.js` npm ERR! message `sh "-c" "node install.js"` failed with 127 npm ERR! errno {}
Update (March 15th, 2013)
At the moment the repository has version 0.8.14 included while the latest version is version 0.10. This tutorial has been updated and successfully tested.
As maintaining old tutorials and old blog posts costs time, feel free to donate me a virtual beer. Drop me a message here and
tell me what your favourite donation channel is (like flattr whehere
I haven’t an account yet).
Preparation
The nodejs package depends on a couple of other packages, be sure that you have the repository component universe enabled.# in /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu quantal main restricted universe deb http://security.ubuntu.com/ubuntu quantal-security main restricted universe deb http://archive.ubuntu.com/ubuntu quantal-updates main restricted universe
After enabling it run
sudo apt-get update.
Installation steps
In order to get a more recent nodejsversion
you need to add a personal package
archive (ppa) and update the package index files. To do so open Terminal and
execute the following commands.
sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs
Pay attention to the second line, if you are trying to execute
apt-apt-repositoryyou
won’t have luck.
Install the node package manager
Update (March 15th, 2013)You no longer need to install npm separately as nodejs includes it now.
To manage your nodes it’s recommended to install the node package manager (npm) too.
sudo apt-get install npm
Who prefers to compile
npm from its sources will find this
script very useful.
Update (March 20th, 2013)
It looks like somebody forgot to pay his bill. The link to the script is currently broken.
Update (April 15th, 2013, 19:50 UTC+2)
A guy from Israel has grabbed the domain which has expired three and a half hours ago.
相关文章推荐
- Ubuntu 11.10 安装Node.js的方法
- Ubuntu9.10 安装node.js
- 详解如何在ubuntu上安装node.js
- 在Ubuntu 上安装node.js
- ubuntu 安装node.js 最新版本
- Ubuntu 11.10 安装Node.js的方法
- ubuntu 12.04 安装node.js
- node.js在Ubuntu 12.04下的安装和配置
- ubuntu 12.04 安装 node.js
- ubuntu下安装node.js
- 如何在ubuntu上安装node.js
- Node.js 在Ubuntu 安装说明
- Ubuntu上安装Nodejs/ZeroMQ/MySQL
- 如何在 Ubuntu 中安装 Node.js
- Ubuntu 安装node.js
- ubuntu下安装node.js
- Ubuntu安装node.js
- Redis加Node.js的全文搜索引擎 Reds在Ubuntu下面 的安装
- 【mark】有关node.js的图片插件 node-images 在 ubuntu 12.04 安装不上的解决方案
- Ubuntu 编译安装node.js