windows下配置Sublime Text 2开发Nodejs

1 下载 Sublime Text 2
http://www.sublimetext.com/

2 下载Nodejs插件,下载ZIP包
https://github.com/tanepiper/SublimeText-Nodejs

3 解压ZIP,重命名为Nodejs

4 将Nodejs复制到C:UsersAdministratorAppDataRoamingSublime Text 2Packages目录下

5 重启Sublime Text 2 ->Tools-->Build System -->Nodejs

6 配置nodejs的path Preferences-->Package Setting-->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": "D:\tools\nodejs\node.exe",
  // Same for NPM command
  "npm_command": "D:\tools\nodejs\npm.cmd",

  "expert_mode": true,

  "ouput_to_new_tab": false
}

7 C:UsersAdministratorAppDataRoamingSublime Text 2Packages odejsNodejs.sublime-build进行修改,附我修改内容如下:

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

8 好了配置好开发工具就可以进行开发了。

我们在编辑器创建一个js 文件,ctrl+b运行或在 Tools->nodejs -> run就可以运行了。

原文地址:https://www.cnblogs.com/Lzly/p/3816100.html