新聞中心
下面分別介紹在Mac, Ubuntu,Centos以及Windows下安裝Node.js.

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供天壇街道網(wǎng)站建設(shè)、天壇街道做網(wǎng)站、天壇街道網(wǎng)站設(shè)計、天壇街道網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、天壇街道企業(yè)網(wǎng)站模板建站服務(wù),10多年天壇街道做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。
Mac
在Mac下,如果你喜歡用homebrew,那么只用一行就可以裝好:
- brew install node
否則,只能考慮手工安裝了,步驟如下:
1. 安裝Xcode
2. 安裝git
3 .運行下面的命令行編譯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,步驟如下:
1. 安裝cygwin
2 在cygwin的目錄下,運行setup.exe安裝下面列表中的包
◆ devel → openssl
◆ devel → g++-gcc
◆ devel → make
◆ python → python
◆ devel → git
3. 運行cygwin
4. 運行下面的命令行:
- 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 http://127.0.0.1:8124/');
用node來運行這段代碼
- node hello_node.js
- Server running at http://127.0.0.1:8124/
現(xiàn)在,用瀏覽器打開 http://127.0.0.1:8124/ , 應(yīng)該能夠看到一條好消息。
參考文檔
How to Install Node.js http://howtonode.org/how-to-install-nodejs
Update
補充了在centos上安裝Node.js的步驟
原文:http://www.ooso.net/archives/589
本文名稱:如何安裝Node.js
標(biāo)題路徑:http://www.5511xx.com/article/dpeccpj.html


咨詢
建站咨詢
