1. 环境安装
首先得有nodejs环境,可以去nodejs官网下载安装。
安装后在cmd输入node -v
查看是否安装成功。
2. Sublime配置
sublime中工具->编译系统->新建编译系统
填写如下信息
{
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"working_dir": "${file_path}",
"selector": "source.js",
"shell": true,
"encoding": "utf-8",
"windows": {
"cmd": ["node", "$file"]
},
"linux": {
"cmd": ["killall node; node", "$file"]
}
}
保存为javascript.sublime-build
。
3. 测试
写一段js,如console.log("hello world");
。然后使用快捷键 ctrl + B 查看是否输出hello world
内容,输出则配置成功。
如果觉得我的文章对您有用,请您随意打赏。您的支持将鼓励我更加努力创作!
如无特殊声明,文章均为原创,若有不正之处,万望告知。转载请附上原文地址,十分感谢!