$ ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)$ brew install node$ nano hello_node.js$ vi hello_node.jsvar http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Sugeng Rawuh Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');$ node hello_node.jsServer running at http://127.0.0.1:8124/http://127.0.0.1:8124/Sampai tahapan-tahapan di atas, Anda sudah berhasil meng-install node.js dengan menggunakan Brew tanpa npm.
Apa itu npm ?
npm is a NodeJS package manager. As its name would imply, you can use it to install node programs. Also, if you use it in development, it makes it easier to specify and link dependencies.
Untuk mengaktifkan npm, ikuti langkah-langkah berikut:
curl https://npmjs.org/install.sh | shexport NODE_PATH=/usr/local/lib/node_modules