Mac – How to install npm

NPM

this is tool which help to install package for node.js.

following below steps.

# curl https://npmjs.org/install.sh | sudo sh
you can see below contents:

tar=/usr/bin/tar

version:
bsdtar 2.8.3 – libarchive 2.8.3
install npm@1.0
fetching: http://registry.npmjs.org/npm/-/npm-1.0.106.tgz
0.5.11-pre
1.0.106
cleanup prefix=/usr/local

All clean!

/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npm_g -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npm-g -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm@1.0.106 /usr/local/lib/node_modules/npm
It worked

Node.js – hello.js

follow the below step:

var http = require('http');

http.createServer(function(request, response) {
 response.writeHead(200);
 response.write("hello, this is blog");
 response.end();              

}).listen(8080);

console.log(‘Listening on port 8080…’);