注意:文件末尾的空格;
配置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:\bin\node.exe" "node_command": "C:\\Program Files\\nodejs\\node.exe", // Same for NPM command "npm_command": "C:\\Program Files\\nodejs\\npm.cmd", // as 'NODE_PATH' environment variable for node runtime "node_path": true, "expert_mode": false, "ouput_to_new_tab": false }
打开刚才的nodejs文件夹 找到根目录里面的 Nodejs.sublime-build文件 如下
{ "cmd": ["node", "$file"], "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", "selector": "source.js", "shell":true, "encoding": "cp1252", "windows": { "cmd": ["taskkill /F /IM node.exe & node", "$file"] }, "linux": { "cmd": ["killall node; node", "$file"] }}