zoukankan      html  css  js  c++  java
  • Ubuntu安装node.js

    1.安装依赖:

    sudo apt-get install g++ curl libssl-dev apache2-utils 
    sudo apt-get install git-core 

    2.下载node.js,0.6.x为node.js的稳定版;

    wget http://nodejs.org/dist/v0.6.1/node-v0.6.1.tar.gz 

    3.解压执行初始化;

    tar zxvf node-v0.6.1.tar.gz 
    cd node-v0.6.1 
    ./configure 

    4.编译;

    make 
    make install

    5.验证安装;

    node -v      

    6.例子;

      (1)编写测试用例,test.js;

    View Code
    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/'
    );

      (2)在浏览器中验证;

    7.安装coffeeScript;

    npm install --global coffee-script

    8.验证安装:

    coffee -v   

    9.配置coffeescript环境变量:

    export NODE_PATH=/usr/lib/node_modules。

    NODE_PATH的值可以使用一下命令获取:

    npm ls -g  

    配置node和coffeescript的关联

    $ node
    > require('coffee-script')

    OVER

  • 相关阅读:
    高德地图
    微信小程序蓝牙
    微信小程序请求封装
    create-react-app配置less
    浏览器渲染原理及流程
    输入网址到呈现网页发生的过程
    cookie的理解
    浏览器本地存储
    cookie,localStorage,sessionStorage区别
    关于this指向
  • 原文地址:https://www.cnblogs.com/kakag/p/3023696.html
Copyright © 2011-2022 走看看