Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS won't build in Sublime Text 2 [Errno 2] No such File or Directory

I've scoured all other posts on this subject to no avail.

I've created a .scss file, installed sass, compass and I'm on OSX so I have ruby installed, I did install the latest version about a year ago however.

When I cmd + b to build my .scss I get this error:

Errno 2] No such file or directory
[cmd:  [u'sass', u'--update', u'/Users/administrator/Desktop/style.scss:/Users/administrator/Desktop/style.css', u'--stop-on-error', u'--no-cache']]
[dir:  /Users/administrator/Desktop]
[path: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

Here is what is in my Ruby.sublime-build file:

{
"cmd": ["ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby",
}
like image 804
thomasp423 Avatar asked Feb 14 '23 21:02

thomasp423


1 Answers

The reason the build command isn't working is because Sublime can't find your sass executable. If you open Terminal and type which sass at the prompt, it'll most likely give you a location along the lines of /Users/username/.rvm/gems/ruby-1.9.3-p385/bin/sass - it's location on my system. As you can see right in the output you posted, Sublime is only looking in a few directories for it, unfortunately it's not in any of the directories being searched.

There are two ways around this. The first is to modify your SASS .sublime-build file (Ruby.sublime-build has nothing to do with this) to point to the correct location of sass. The second is to run

sudo ln -s /path/to/sass /usr/local/bin/sass

at the command prompt (obviously substituting the correct path for your system) to create a symlink to sass in /usr/local/bin, which is one of the directories Sublime is searching. Either one will do fine, although if you ever update your ruby version and the sass gem, you'll need to update either the build file or the symlink.

like image 180
MattDMo Avatar answered Mar 15 '23 23:03

MattDMo