在顶部导航内,打开tools
里的build system
下的new build sytstem
后会出现一个编辑json
,填入:
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.js",
"shell":true,
"encoding": "utf8",
"windows":{
"cmd": ["taskkill","/F", "/IM", "node.exe","&","node", "$file"]
},
"linux":{
"cmd": ["killall node; node", "$file"]
},
"osx":{
"cmd": ["killall node; node $file"]
}
保存在user目录下,名为Node.sublime-build
文件,就ok了,在编辑器中编辑js
文件,使用ctrl+b
即可运行查看