新建nodejs Build System:
在sublime菜单上找到Tools ---> Build System ---> new Build System,复制下面的配置内容:
{
"cmd"
: [
"node"
,
"$file"
],
"file_regex"
:
"^[ ]*File \"(...*?)\", line ([0-9]*)"
,
"selector"
:
"source.js"
,
"encoding"
:
"utf-8"
,
// "encoding": "cp936",根据自己需要编码格式,防止乱码。
"shell"
:
true
,
"windows"
:
{
"cmd"
: [
"taskkill"
,
"/F"
,
"/IM"
,
"node.exe"
,
"&"
,
"node"
,
"$file"
]
},
"linux"
:
{
"cmd"
: [
"killall node; node"
,
"$file"
]
}
}
然后重新启动sublime即可