SASS无法在Sublime Text 2 [Errno 2]中建立,没有这样的文件或目录 [英] SASS won't build in Sublime Text 2 [Errno 2] No such File or Directory

查看:128
本文介绍了SASS无法在Sublime Text 2 [Errno 2]中建立,没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了与此相关的所有其他帖子,都无济于事。

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

我创建了一个.scss文件,安装了sass,指南针,并且OSX,所以我安装了ruby,但是大约一年前确实安装了最新版本。

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.

当我用cmd + b构建我的.scss时,出现此错误:

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]

这是我的Ruby.sublime构建文件中的内容:

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

{
"cmd": ["ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby",
}


推荐答案

之所以无法使用build命令,是因为Sublime无法找到您的 sass 可执行文件。如果打开终端并在提示符下键入 assass ,则很可能会在 / Users / username /中为您提供位置。 rvm / gems / ruby​​-1.9.3-p385 / bin / sass -它在我的系统上的位置。正如您在发布的输出中看到的那样,Sublime只在几个目录中查找它,不幸的是它不在搜索的任何目录中。

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.

有有两种解决方法。第一种是修改 SASS .sublime-build 文件( Ruby.sublime-build 与此无关)指向 sass 的正确位置。第二种是运行

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

在命令提示符下(显然为您的系统替换了正确的路径),以在<$ c中创建指向sass的符号链接$ c> / usr / local / bin ,这是Sublime正在搜索的目录之一。不管哪种方式都可以,尽管如果您更新红宝石版本和sass gem,则需要更新构建文件或符号链接。

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.

这篇关于SASS无法在Sublime Text 2 [Errno 2]中建立,没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆