1.to the current user.
## log install node.0.8.9 to /home/zhng/devHome/node/0.8.9 #0. prepare sudo apt-get install g++ sudo apt-get install curl #1. download wget http://nodejs.org/dist/v0.8.9/node-v0.8.9.tar.gz #2. tar tar -zvxf http://nodejs.org/dist/v0.8.9/node-v0.8.9.tar.gz #3. before make, update configure cd node-v0.8.9 ./configrue --prefix=${HOME}/devHome/node/0.8.9 #4. make make #5. install make install #6. set current user's env echo 'export PATH=${HOME}/devHome/node/0.8.9/bin:${PATH}' >> ~/.bashrc #7. make the env come to force . ~/.bashrc #8. install npm ##https://npmjs.org/doc/README.html ##Fancy Install (Unix) ###here's a pretty robust install script at https://npmjs.org/install.sh. You can download that and run it curl https://npmjs.org.org/install.sh | sh #9. test npm npm install hexy
2.js check.
#1. douban-jslint ##https://github.com/kejun/Douban-JSLint ##without the option g. it's installed in the current directory. npm install -g http://github.com/kejun/Douban-JSLint/tarball/master #2 install closure-lint ## https://developers.google.com/closure/utilities/docs/linter_howto?hl=zh-TW ##2.1. python easy_install sudo apt-get install python-setuptools ##2.2 sudo easy_install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
nodejs's Helloworld
3. Hello World.
// Helloworld.js // nodejs's Helloworld.js console.log('Helloworld');
4.nodejs's simple http server.
// server1.js // nodejs's simple server. var http = require('http'); http.createServer(function(request, response) { //reponse's head response.writeHead(200, {'Content-TYpe': 'text/html'}); response.write('<h1>Node.js</h1>'); //say it's the end. response.end('<p>a simple http server</p>'); } ).listen(3000); cnsole.log('http server is listending at port 3000.');
5.....