- Add new build systems via
Tools > Build System > New Build System. - Save files as Language.sublime-build
- Any commandline tool for compiling code can be used.
- Cmd + B (OSX) will build files and send output to the Sublime Console
-
-
Save corbanb/d0d6bdcfbd8eb455ce99 to your computer and use it in GitHub Desktop.
| // Sublime Text 2 Build System for Javascript | |
| { | |
| "cmd": ["node", "$file"], | |
| "selector": "source.js" | |
| } |
| // Sublime Text 2 Build System for PHP | |
| { | |
| "cmd": ["php", "$file"], | |
| "selector": "source.php" | |
| } |
Can anyone explain this? "[Errno 2] No such file or directory: 'node'"
Hi, @brandl3s. Using the method posted in this Gist requires you have Node.js installed on your computer. It's what Sublime will execute the JavaScript file. If you haven't installed Node yet, you'll have to do that first.
The error message you received is saying that the system doesn't know what 'node' is, that it can't find the installation. So, much like carmanchris31 above, you'll need to provide the file path that Sublime should use to find your Node installation.
If you have Node installed, you can run the terminal command, which node to determine the path to your installation. You can then replace node with that path and things ought to work correctly.
Here's what mine build file looks like.
// Sublime Text - Build System for JavaScript
{
"cmd": ["/usr/local/bin/node", "$file"],
"selector": "source.js"
}
The one carmanchris31 posted above should also work.
Hope that helps.
This is super helpful for me.. Never delete it. :)
Thanks @TravisIngram!! New to programming. I did exactly as you said, worked!
Thanks @corbanb and @TravisIngram.
How do we add a python virtual environment
Doesn't work. SyntaxError: Unexpected token :
/Library/Application Support/Sublime Text 3/Packages/User/nodejs.sublime-build:2
"cmd": ["/usr/local/bin/node", "$file"],
^
SyntaxError: Unexpected token :
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
[Finished in 0.1s with exit code 1]
hey @wzup this instructions might help you -
- Open your sublime
- Open a .js file
- Tools > Build System > Select your custom build system (the one you created earlier).
- Try again to run your program (CTRL+B - shortcut for windows)
'which node' command doesn't work for me. I am using windows 10. I could install node successfully and i can also see the installed version using node --version
What is source.js here?
hey Folks, i was trying to use javascript for Competitive Programming . i can't find a way to take the input . I came across readline() function but this is not working in sublime-text3 . please help !
Where should we save the file in (macOS)?


I have Node installed via HomeBrew and Sublime wasn't reading my shell PATH variable so I had to add a path variable to the build file like so: