得到Errno :: ENOENT:在sass watch命令上没有这样的文件或目录

时间:2011-05-05 12:23:31

标签: ruby sass

我在我的Windows系统上安装了Ruby以使用Sass,以便在我的PHP项目中遵循CSS主题中的最佳实践,如Best Practices - CSS Theming中所述。我以前从未使用过Ruby或Sass。

安装完成后,我转到Start Command Prompt with Ruby并输入 -

gem install sass

并且安装成功。

然后按照http://sass-lang.com/tutorial.html中给出的教程,

我在test.scss创建了两个文件test.css/some/path,它位于我的网络目录(PHP开发环境)中。我在test.scss -

中写了以下内容
/* test.scss */
#navbar {
  width: 80%;
  height: 23px;
}

我在Ruby命令提示符下输入/some/path并输入 -

sass --watch test.scss:test.css

得到了这个输出 -

Sass is watching for changes. Press Ctrl-C to stop.
Errno::ENOENT: No such file or directory - test.scss
Use --trace for backtrace

即使我给出了css文件的完整绝对路径,也会出现错误。如果我在命令中添加--trace,则输出 -

C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin/compiler.rb:317:i
n `read': No such file or directory - C:\xampp\htdocs\examvillage_recovered\bran
ches\I18N\trunk\style\dev_styles\test.scss (Errno::ENOENT)
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin/comp
iler.rb:317:in `update_stylesheet'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin/comp
iler.rb:169:in `block in update_stylesheets'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin/comp
iler.rb:167:in `each'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin/comp
iler.rb:167:in `update_stylesheets'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin/comp
iler.rb:214:in `watch'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/plugin.rb:1
11:in `method_missing'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/exec.rb:408
:in `watch_or_update'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/exec.rb:294
:in `process_result'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/exec.rb:41:
in `parse'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/lib/sass/exec.rb:21:
in `parse!'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/sass-3.1.1/bin/sass:8:in `<top
(required)>'
        from C:/Ruby192/bin/sass:19:in `load'
        from C:/Ruby192/bin/sass:19:in `<main>'

然后浏览了这个YouTube视频http://www.youtube.com/watch?v=b_-HLevIJbc,其中提到了安装步骤。我也安装了gem haml并成功安装。

但我仍然收到此错误并另外通知

NOTE: Gem::Specification#default_executable= is deprecated with no replacement.
It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from C:/Ruby192/lib/ruby/gems/1.9
1/specifications/rubygems-update-1.8.0.gemspec:11.
>>> Sass is watching for changes. Press Ctrl-C to stop.
Errno::ENOENT: No such file or directory - C:\xampp\htdocs\examvillage_recovere
\branches\I18N\trunk\style\dev_styles\test.scss
  Use --trace for backtrace.

我该如何解决这个问题?有什么指针吗?

由于

1 个答案:

答案 0 :(得分:0)

我建议你打开cmd。然后提供scss文件所在文件夹的父文件夹的完整路径。然后输入“sass --watch Foldername:Foldername”,然后按enter键。

在你的情况下,它应该在cmd中看起来与此类似:

C:\xampp\htdocs\examvillage_recovered\branches\I18N\trunk\style>sass --watch dev_styles:dev_styles