问题
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",
}
回答1:
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.
来源:https://stackoverflow.com/questions/19610553/sass-wont-build-in-sublime-text-2-errno-2-no-such-file-or-directory