原文地址:http://www.ooso.net/archives/589
参考地址:http://cnodejs.org/blog/?p=2080
下面分别介绍在Mac, Ubuntu,Centos以及Windows下安装Node.js.
Mac
在Mac下,如果你喜欢用homebrew,那么只用一行就可以装好:
brew install node
否则,只能考虑手工安装了,步骤如下:
Ubuntu
Windows
用cygwin来安装node,步骤如下:
Centos
yum install gcc-c++ openssl-develwget --no-check-certificate https://github.com/joyent/node/tarball/v0.3.3tar -xzvf ry-node-v0.3.3-0-g57544ba.tar.gzcd ry-node-v0.3.3-0-g57544bac1./configuremakemake install
Hello Node.js!
写一段小程序例如hello_node.js来验证安装是否正确:
var http = require('http');http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Node.jsn');}).listen(8124, "127.0.0.1");console.log('Server running at http://127.0.0.1:8124/');
用node来运行这段代码
node hello_node.jsServer running at http://127.0.0.1:8124/
现在,用浏览器打开 http://127.0.0.1:8124/ , 应该能够看到一条好消息。
完
原文链接: https://www.cnblogs.com/wangkangluo1/archive/2011/09/19/2181012.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/32613
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!