Node.js offline installation in Windows
ဟိုတနေ့က node.js ကို windows မှာစမ်းကြည့်ချင်လို့ရှာတာတော်တော်လေးရှာယူရပါတယ်။ ပုံမှန်အားဖြင့် Linux ပေါ်မှာ ဒါမှမဟုတ် အင်တာနက် ကော်နက်ရှင်နဲ့ ချိတ်ပြီး Install လုပ်တာတွေကိုသာအများအားဖြင့်တွေ့ရပါတယ်။ Windows ပေါ်မှာဆိုရင်လည်း cgywin နဲ့တွဲသုံးတာတွေကိုတွေ့ရပေမယ့် ကော်နက်ရှင်မကောင်းရင် cgywin သွင်းတဲ့အဆင့်မှာတင်တော်တော်လေးကြာပြီတစ်နေပါတယ်။ ဒီတော့ connection မကောင်းတာအခါပဲဖြစ်ဖြစ် offline သွင်းလို့ရအောင် package တွေရှာတော့လည်း တော်တော်လေးကို ခေါင်းနောက်နေအောင်ရှာမှတွေ့ပါတယ်။ တခြားအလားတူနည်းလမ်းတွေလည်းရှိပါတယ်။ ကျွန်တော်ကတော့ ဒါနဲ့အဆင်ပြေသွားလို့ဒီနည်းလမ်းနဲ့ရေးလိုက်ပါတယ်။ ကျန်တဲ့တခြားနည်းလမ်းတွေလည်းရှိပါဦးမှာပါ။ ပထမဆုံး ဒီက node.exe ဆိုတာကိုဒေါင်းပါ။

ပုံပါအတိုင်း C: ထဲမှာ node ဆိုပြီး folder တစ်ခုဆောက်ပြီး node.exe ကိုထည့်လိုက်ပါ။ ပြီးရင် django မှာ setup လုပ်သလိုပဲ environment variable တစ်ခုကြေညာရပါမယ်။ ဘာဖြစ်လို့လဲဆိုတော့ ဒီပတ်လမ်းကြောင်းခဏခဏရိုက်ရတာရှည်လို အလွယ်သုံးချင်လို့ပါ။ ဒီတော့ My Computer -> righ click properties -> advanced system ဆိုရင် environment variable ဆိုတဲ့ tab ကိုတွေ့ရပါမယ်။ အောက်ပုံအတိုင်းပါ။

ပြီးရင် click နှိပ်ပါ။ အောက်ကပုံအတိုင်း path ဆိုတဲ့ variable ကိုရွေးပြီး edit လုပ်လိုက်ပါ။

နောက်ဆုံးမှာ ; (execution အဆုံးသတ်တာကိုညွန်ပြတဲ့အနေနဲ့) နဲ့ပိတ်ပြီး နောက် instruction တစ်ကြောင်းအနေနဲ့ မိမိ node.exe ရှိတဲ့ path ကိုထည့်ပါ။ ကျွန်တော်ပြတဲ့အတိုင်းဆိုရင်တော့ C:\node ထဲကိုထည့်ရမှာပါ။ ပြီးရင် ; နဲ့ပြန်ပိတ်ပါ။ မသေချာရင်အောက်ပုံကိုကြည့်ပြီးလုပ်နိုင်ပါတယ်။

အဲဒါဆိုရင်တော့ node.js ကို run လို့ရပါပြီ။ စမ်းပြီးတော့ run ကြည့်လိုက်ရအောင် ။ command prompt ထဲကိုသွားလိုက်ပါ။ node လို့ရိုက်လိုက်ပါ။ console တစ်ခုပေါ်လာတယ်ဆိုရင်မှန်ပါပြီ။ စမ်းပြီးတော့
console.log('Hi i am in console log');
လို့ရိုက်ကြည့်ပါ။ အောက်ကပုံအတိုင်းပေါ်ရင်မှန်ပါပြီ။

ကျွန်တော်တို့ နောက်တစ်ဆင့်အနေနဲ့ HTTP Server တစ်ခု create လုပ်ပြီး Browser ပေါ်ကနေ Hello World ကြည့်ရအောင်။
notepad ဖြစ်ဖြစ် text editor ဖြစ်ဖြစ်ဖွင့်လိုက်ပါ။ အောက်ကအတိုင်း ရိုက်ပြီး helloworld.js လို့သိမ်းလိုက်ပါ။
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World \n");
});
// Listen on port 8000, IP defaults to 127.0.0.1
server.listen(80);
// Put a friendly message on the terminal
console.log("Server running at http://127.0.0.1:80/");
ပြီးရင် cmd ကနေ အဲဒီ directory ကိုရောက်အောင်သွားပါ။ ပြီးရင် node helloworld.js လို့ရိုက်လိုက်ပါ။
Server running at http://127.0.0.1:80/ ဆိုရင်မှန်ပါပြီ။

Browser ကိုဖွင့်လိုက်ပါ။ 127.0.0.1 ဒါမှမဟုတ် localhost လို့ရိုက်ပြီးခေါ်ကြည့်လိုက်ပါ။ Hello World ကိုမြင်တွေ့ရမှာဖြစ်ပါတယ်။

Facebook comments:




Wow … Really Nice …
[...] Node.js offline installation in windows [...]
Links is wrong.http://nodejs.org/dist/v0.5.5/node.exe%20 is not working u should change to
http://nodejs.org/dist/v0.5.5/node.exe ……
Just point out.
node.js for windows , still not support NPM yet ;(
well fix it now
[...] windows မှာ အသေးစိတ် သွင်းနည်းကိုတော့ ဒီမှာ [...]