I justed started learning JavaScript. While doing that, I got tired of embedding my JavaScript code into an HTML document in order to run it in the browser. I thought it wou
This woks for me in Windows7
1) Open Sublime Text, Goto "Tools" -> "Build System" -> "New Build System"
2) Paste this text
{
"cmd": ["C:\\Program Files (x86)\\nodejs\\node","$file"]
}
\\ Escaping character
3) Save as Node.sublime-build
4) Write a new js file, and press CTRL+B for build.
Click here for see image example.
On linux I use this, just make sure you are on your main file
{
"shell_cmd": "pkill node ; node $file"
}
{
"cmd": ["node","$file"]
}
works perfectly for me in windows and it shows the output in the sublime window. Although I dont know how to stop the server after from sublime, I have to search and kill the node process.
Also, check node is in your PATH ;)
Hope it works for you.
Here is a tip for Windows,
Most of the answers from this thread is correct but none is complete and at least no answer tells about how to kill existing Node process even if you are able to run node in sublime. So eventually if either of above approach worked for you, You will end up manually killing Node always.
Here is What I have done for 'Windows':
taskkill /F /IM "node.exe" "c:/Program Files/nodejs/node.exe" %1
Enjoy noding.
On Windows, the following configuration works:
{
"cmd": ["C:\\Program Files\\nodejs\\node.exe", "$file"],
"selector": "source.js"
}
I can only see the console output only if the file exists/saved on disk. (for anonymous file I don't see the output either)
Hope this helps