码迷,mamicode.com
首页 > Web开发 > 详细

Nodejs安装

时间:2015-07-17 20:15:15      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:

1 下载NodeJS  

  https://nodejs.org/download/

  最新版下载地址 

  # wget https://nodejs.org/dist/v0.12.7/node-v0.12.7.tar.gz

 

2 解压安装NodeJS

  # tar zxvf node-v0.12.7.tar.gz

  # cd node-v0.12.7

  # ./configure

  # make 

  # make install

  验证是否安装完成 

  # node -v

  v0.12.7  (能看到版本号说明安装成功)

 

3 验证是否能正常启动

  1. 建立文件 app.js

var http = require("http");
exports.start = function(){
  http.createServer(function(request, response) {
    response.write(‘Server start Success ...‘);
    response.end();
  }).listen(8899);
}
exports.start();

2. 修改文件 app.js 的属性

# chmod 777 app.js

3. 启动NodeJS

# node app.js

4. 访问 http://ip:8899 

如果能正常看到页面 说明配置成功。

 

Nodejs安装

标签:

原文地址:http://www.cnblogs.com/nickyhubin/p/4655281.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!