如何安装Node.js
2011-07-04 13:50
591 查看
转自:http://www.ooso.net/archives/589
下面分别介绍在Mac, Ubuntu,Centos以及Windows下安装Node.js.
安装Xcode
安装git
运行下面的命令行编译node.js
运行下面的命令行:
安装cygwin
在cygwin的目录下,运行setup.exe安装下面列表中的包devel → openssl
devel → g++-gcc
devel → make
python → python
devel → git
运行cygwin
运行下面的命令行:
下面分别介绍在Mac, Ubuntu,Centos以及Windows下安装Node.js.
Mac
在Mac下,如果你喜欢用homebrew,那么只用一行就可以装好:brew install node否则,只能考虑手工安装了,步骤如下:
安装Xcode
安装git
运行下面的命令行编译node.js
git clone git://github.com/joyent/node.git cd node ./configure make sudo make install
Ubuntu
安装依赖包sudo apt-get install g++ curl libssl-dev apache2-utils sudo apt-get install git-core
运行下面的命令行:
git clone git://github.com/joyent/node.git cd node ./configure make sudo make install
Windows
用cygwin来安装node,步骤如下:安装cygwin
在cygwin的目录下,运行setup.exe安装下面列表中的包devel → openssl
devel → g++-gcc
devel → make
python → python
devel → git
运行cygwin
运行下面的命令行:
git clone git://github.com/joyent/node.git cd node ./configure make sudo make install
Centos
yum install gcc-c++ openssl-devel wget --no-check-certificate https://github.com/joyent/node/tarball/v0.3.3 tar -xzvf ry-node-v0.3.3-0-g57544ba.tar.gz cd ry-node-v0.3.3-0-g57544bac1 ./configure make make install
Hello Node.js!
写一段小程序例如hello_node.js来验证安装是否正确:var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Node.jsn'); }).listen(8124, "127.0.0.1"); console.log('Server running at 用node来运行这段代码' target='_blank'>http://127.0.0.1:8124/');[/code]用node来运行这段代码node hello_node.js Server running at http://127.0.0.1:8124/[/code]现在,用浏览器打开 http://127.0.0.1:8124/ , 应该能够看到一条好消息。
相关文章推荐
- 如何在ubuntu上安装node.js
- Linux 有问必答:如何在 Linux 上安装 Node.js
- 如何安装node.js
- 如何在Debian 8上安装Node.js
- 如何彻底删除node.js以及node.js安装教程(基于Centos其他linux版本可以类推 )
- 如何安装node.js支持插件
- 如何安装Node.js
- 如何在Linux上安装Node.js
- Node.js入门教程:Node.js如何安装配置并部署一个网站
- 如何安装Node.js
- 如何安装Node.js
- 如何在Ubuntu上安装最新版本的Node.js
- 如何安装Node.js
- 如何安装Node.js环境
- React是什么;在Node.js环境下如何安装?
- 如何安装Node.js
- node.js安装及grunt插件,如何进行脚本压缩
- 【转载】如何安装Node.js
- Node.js入门教程:Node.js如何安装配置并部署第一个网站