w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Node Build System in Sublime Text 2 for the First Time

There are three options for getting your build systems to work.

First, you can edit your Node.sublime-build file to look like this:

    "cmd": ["/usr/local/bin/node", "$file", "$file_base_name"],
    "working_dir": "${project_path:${folder}}",
    "selector": "*.js"

by adding /usr/local/bin/ to the beginning of the node command to give its fully qualified path.

Alternatively, since you're on Lion (this doesn't work on Mt Lion), you can alter the path for Dock-launched programs (by default it's /usr/bin:/bin:/usr/sbin:/sbin, as you've seen). From Terminal, run the following:

launchctl setenv PATH $PATH

(you may have to prefix it with sudo, I'm not sure). The, run:

osascript -e 'tell app "Dock" to quit'

and restart Sublime. This has the advantage of allowing other build systems (I'm especially thinking of Ruby, since you're using RVM) to work out of the box, without messing around with their .sublime-build files as well. For this and the next option, you'll need to remember to update the path when you update Ruby.

The third option, which is necessary on Mountain Lion (not sure about Mavericks) is outlined in my answer here. Basically, you need to edit /etc/launchd.conf (or create it if it doesn't exist) to define PATH, then save and reboot. This is necessary because the launchctl command on 10.8 doesn't do what we want it to do. This option may also work on Lion, but I haven't tested it, since I had already upgraded to Mt Lion before I developed it.

I hope this all helps. Good luck!

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.