zoukankan      html  css  js  c++  java
  • sublime配置开发nodejs

    1.下载https://github.com/tanepiper/SublimeText-Nodejs

    2.解压到sublime->Preferences->Browse Packages 打开的目录,然后改名nodejs

    3.重启sublime,选择Tools->Build System->nodejs

    4.打开Preferences->Package Settings->Nodejs->Default配置如下:

    {
    // save before running commands
    "save_first": true,
    // if present, use this command instead of plain "node"
    // e.g. "/usr/bin/node" or "C:in ode.exe"
    "node_command": "C:\Program Files\nodejs\node.exe",
    // Same for NPM command
    "npm_command": "C:\Program Files\nodejs\npm.cmd",
    // as 'NODE_PATH' environment variable for node runtime
    "node_path": "C:\Program Files\nodejs",

    "expert_mode": false,

    "ouput_to_new_tab": false
    }

    5.打开插件包中的Nodejs.sublime-build配置如下:

    {
    "cmd": ["node", "$file"],
    "file_regex": "^[ ]*File "(...*?)", line ([0-9]*)",
    "selector": "source.js",
    "shell":true,
    "encoding": "GB2312",
    "windows":
    {
    "cmd": ["node", "$file"]
    },
    "linux":
    {
    "cmd": ["killall node; node", "$file"]
    }
    }

    6 测试 编写如下代码

    var http = require('http');
    var os = require('os');

    http.createServer(function (request, response) {
    response.writeHead(200, {'Content-Type': 'text/plain'});
    response.end('Hello World ');

    }).listen(8124);

    console.log('Server running at http://127.0.0.1:8124/');

    然后按ctrl+B查看

  • 相关阅读:
    vim 编辑器
    用得到到的超方便软件
    关于 lua table表
    python 写入文件形式
    ifconfig中lo、eth0、br0、wlan0接口
    CPU:chip、core 和 processor 的关系
    lua 匹配空白符
    排序,查找(借鉴某大神的想法)
    sublime 快捷键
    获取进程的名称
  • 原文地址:https://www.cnblogs.com/yfann/p/3662882.html
Copyright © 2011-2022 走看看