Sublime2 运行NodeJS

来源:互联网 发布:电脑录音软件 编辑:程序博客网 时间:2024/05/22 14:54


Tools --> Build System --> new Build System 

  1. 在打开的文件中输入

    {

        "cmd": ["node", "$file"],

        "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",

        "working_dir": "${project_path:${folder}}",

        "selector": "source.js",

        "shell": true,

        "encoding": "utf-8",

        "windows": {

            "cmd": ["node", "$file"]

        }

    }

  2. 如果系统不是64位的话,把window的cmd改成

    "cmd": ["taskkill /f /im node.exe >nul 2>nul & node", "$file"]

  3. 先建一个js文件,之后ctrl+b就可以看到运行的结果了。

    Sublime Text 运行 nodejs
    END

注意事项

  • [Decode error - output not utf-8] [Finished in 1.0s with exit code 1]是因为你没有改window:cmd
  • C:\Users\用户名\Desktop\ 这里的用户名不要用中文
0 0
原创粉丝点击