zoukankan      html  css  js  c++  java
  • NodeJS For Windows

    概述

    NodeJS是一个Javascript运行环境(runtime)。它是对V8引擎的封装。它采用了“事件循环”架构,并使用非阻塞库支持此架构。它适用于数据敏感、实时性网络应用程序。

    相关信息请猛击此处: http://nodejs.org/

    NodeJS在github上的地址:https://github.com/joyent/node

    安装

    如果源码安装,请安装如下依赖:

    l  Python – version 2.6 / 2.7

    l  Libssl-dev – 如果你计划使用SSL/TLS加密,你需要安装这个。

    Windows

    需要python和Microsoft Visual Studio,但不需要OpenSSL。在cmd.exe中做如下操作:

    我安装了python-2.6.6,下载地址为:http://www.python.org/getit/releases/2.6.6/

    Tar工具的下载地址为:http://gnuwin32.sourceforge.net/packages/gtar.htm

    VS要求是2010。。。。。

    C:\Users\ryan>tar -zxf node-v0.6.5.tar.gz

    C:\Users\ryan>cd node-v0.6.5

    C:\Users\ryan\node-v0.6.5>vcbuild.bat release

    [Wait 20 minutes]

    C:\Users\ryan\node-v0.6.5>Release\node.exe

    > process.versions

    { node: '0.6.5',

    v8: '3.6.6.11',

    ares: '1.7.5-DEV',

    uv: '0.6',

    openssl: '0.9.8r' }

    >

     

    看到以上信息后,说明成功安装。

    0.6以上的版本中包含了npm,所以,不需要单独安装。

    验证

    在成功build完nodejs后,让我们运行下helloworld.js程序。

    Helloworld.js内容如下:

    var http = require('http');
    
    http.createServer(function (request, response) {
      response.writeHead(200, {'Content-Type': 'text/plain'});
      response.end('Hello World\n');
    }).listen(8124);
    
    console.log('Server running at http://127.0.0.1:8124/');

    打开cmd,当前目录为node.exe所在目录,执行下面命令:

    node helloworld.js

    然后,在浏览器中输入地址:http://127.0.0.1:8124/。页面内容为Hello World。

  • 相关阅读:
    常见排序算法总结(一)
    27.移除元素
    556. 下一个更大元素 III
    503. 下一个更大元素 II
    496.下一个更大元素Ⅰ
    汇编基础
    SQL回顾
    Pandas整理
    爬取中公网新闻时政
    Python合并Excel表格
  • 原文地址:https://www.cnblogs.com/lotushy/p/NodeJS_For_Windows.html
Copyright © 2011-2022 走看看