close

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

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

201302200016  

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

201302200018  

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

201302200023  

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

201302200027 

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

201304082122  

Node.js:'Hello!'。

201304082124  

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。

201302200043 

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

201302200048 

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

201302200051  

arrow
arrow

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