If you are considering to develop in nodejs, you should really try Sublime Text Editor 2 with the follwing build setup to let you easly build your node projects.
Sublime Text Editor 2 has a really customizable build system which lets you personalize the way you build your projects. If you configurate it correctly, you will be able to launch your node,js applications just pressing [Ctrl] + [B].
- run Sublime Text Editor
- Under Tools > Build System > press New Build System...
- Paste this:
{
"cmd": ["nodeBuild", "$file"],
"selector" : "source.js",
"path" : "/home/myoArch/Bin"
}
Please note that /home/myoArch/Bin is just my path where I personally prefere to store my sh scripts. You should use /usr/lib or whatever you want.
- Press [Ctrl] + [S] to save the file and name it Node. This operation creates a new file under:
/home/myoArch/.config/sublime-text-2/Packages/User/Node.sublime-build
- Create a new file under /home/myoArch/Bin and name it nodeBuild. This is going to be our launcher script.
- Open the file with your editor
- Paste this:
#!/bin/sh
/usr/bin/killall node
/usr/bin/node $1
and save the file.
Please note again that /usr/bin/node is my path where I have installed the node executable. Always use your paths, not mines!
As you can see, in this script, I always kill all Node istances that are running before launching a new one, In this way Ican just press [Ctrl] + [B] to re run my application.
- At the last point, just make the file runnable: chmod +x nodeBuild
There you go.. Now you can set up your Build System as Node into Sublime Text Editor and run your node application by pressing [Ctrl] + [B].