在 Windows xp、Windows 7 安裝 Node.js,其實超簡單的,看了你就知。

Step one:先去官網下載 http://nodejs.org/ 或 http://nodejs.org/dist/ 列出所有版本。

 

Step two:開始安裝,就一直下一步。

 

Step three:安裝完後,測試一下是否可正常運作,開啟 Node.js command prompt 或 Node.js。

 

Node.js command prompt:輸入 node -e "console.log('Hello World');"。

 

Node.js:直接輸入 10+50。

  

Node.js:'Hello!'。

 

Step four:如果要確認在 Browser 是否正常,就來做一下測試吧!,開啟一個 .txt 檔,內容如下,並存檔為 hello.js,記得副檔名為 .js。

var http = require("http");

http.createServer(function(request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.write("Hello World");
  response.end();
}).listen(8888);
console.log("Node.js runing...");

Step five:在執行一次 Node.js command prompt。

 

Step six:切換到 hello.js 所在資料夾,並執行 node hello.js。

 

Step seven:開啟 Browser,輸入 127.0.0.1:8888。

 

文章標籤
全站熱搜
創作者介紹
創作者 mitblog 的頭像
mitblog

香腸炒章魚

mitblog 發表在 痞客邦 留言(0) 人氣(2,834)