自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何安裝Node.js

開發(fā) 前端
本文分別介紹在Mac, Ubuntu,Centos以及Windows下安裝Node.js.

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

Mac

在Mac下,如果你喜歡用homebrew,那么只用一行就可以裝好:

  1. brew install node 

否則,只能考慮手工安裝了,步驟如下:

1. 安裝Xcode

2. 安裝git

3 .運(yùn)行下面的命令行編譯node.js

  1. git clone git://github.com/joyent/node.git  
  2. cd node  
  3. ./configure  
  4. make  
  5. sudo make install 

Ubuntu

安裝依賴包

  1. sudo apt-get install g++ curl libssl-dev apache2-utils  
  2. sudo apt-get install git-core 

運(yùn)行下面的命令行:

  1. git clone git://github.com/joyent/node.git  
  2. cd node  
  3. ./configure  
  4. make  
  5. sudo make install 

Windows

用cygwin來安裝node,步驟如下:

1. 安裝cygwin

2  在cygwin的目錄下,運(yùn)行setup.exe安裝下面列表中的包

◆ devel → openssl

◆ devel → g++-gcc

◆ devel → make

◆ python → python

◆ devel → git

3.  運(yùn)行cygwin

4.  運(yùn)行下面的命令行:

  1. git clone git://github.com/joyent/node.git  
  2. cd node  
  3. ./configure  
  4. make  
  5. sudo make install 

Centos

  1. yum install gcc-c++ openssl-devel  
  2. wget --no-check-certificate https://github.com/joyent/node/tarball/v0.3.3  
  3. tar -xzvf ry-node-v0.3.3-0-g57544ba.tar.gz  
  4. cd ry-node-v0.3.3-0-g57544bac1  
  5. ./configure  
  6. make  
  7. make install 

Hello Node.js!

寫一段小程序例如hello_node.js來驗(yàn)證安裝是否正確:

  1. var http = require('http');  
  2. http.createServer(function (req, res) {  
  3.   res.writeHead(200, {'Content-Type': 'text/plain'});  
  4.   res.end('Hello Node.jsn');  
  5. }).listen(8124, "127.0.0.1");  
  6. console.log('Server running at http://127.0.0.1:8124/'); 

用node來運(yùn)行這段代碼

  1. node hello_node.js  
  2. 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

補(bǔ)充了在centos上安裝Node.js的步驟

原文:http://www.ooso.net/archives/589

【編輯推薦】

  1. Node.js中實(shí)現(xiàn)文件的循環(huán)寫入
  2. Node.js源碼研究之模塊組織加載
  3. 揭秘Node.js事件
  4. Node.js初探之與Mysql的交互
  5. Node.js入門之神秘的服務(wù)器端JavaScript
責(zé)任編輯:陳貽新 來源: Volcano的博客
相關(guān)推薦

2022-11-17 09:52:12

RHEL 9Node.js

2013-11-01 09:34:56

Node.js技術(shù)

2015-03-10 10:59:18

Node.js開發(fā)指南基礎(chǔ)介紹

2011-11-01 10:30:36

Node.js

2011-09-08 13:46:14

node.js

2011-09-02 14:47:48

Node

2021-05-27 09:00:00

Node.js開發(fā)線程

2022-09-04 15:54:10

Node.jsAPI技巧

2012-10-24 14:56:30

IBMdw

2011-11-10 08:55:00

Node.js

2021-03-09 08:03:21

Node.js 線程JavaScript

2022-08-22 07:26:32

Node.js微服務(wù)架構(gòu)

2021-07-30 11:20:53

JavaScriptNode.jsWeb Develop

2011-10-28 16:05:56

Node.js

2021-12-25 22:29:57

Node.js 微任務(wù)處理事件循環(huán)

2023-10-04 07:35:03

2020-08-05 08:31:51

SSL TLSNode.js

2022-09-12 15:58:50

node.js微服務(wù)Web

2023-03-02 23:09:53

Node.jsC++JS

2020-05-29 15:33:28

Node.js框架JavaScript
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)