当使用'--watch'时,Sass 3.3.0'NoMethodError' - 错误

时间:2014-03-10 13:44:01

标签: sass

在Mac和Windows上安装了全新的稳定Sass 3.3.0(Maptastic Maple)。使用-f --update sass:css时它工作正常。但是在使用--watch时,我得到的是NoMethodError - 错误。

没有--trace:

C:\RemoteProjects\sass-sourcemaps>sass --style expanded --sourcemap --watch sass:css
>>> Sass is watching for changes. Press Ctrl-C to stop.
NoMethodError:

使用--trace

C:\RemoteProjects\sass-sourcemaps>sass --style expanded --watch ./:../css --trace
>>> Sass is watching for changes. Press Ctrl-C to stop.
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/plugin/compiler.rb:327:in `listen_to': undefined method `thread' for #<Listen::Listener:0x00000003c95d58> (NoMethodError)
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/plugin/compiler.rb:294:in `watch'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/plugin.rb:108:in `method_missing'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/exec.rb:509:in `watch_or_update'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/exec.rb:346:in `process_result'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/exec.rb:43:in `parse'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/lib/sass/exec.rb:22:in `parse!'
        from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.3.0/bin/sass:13:in `<top (required)>'
        from C:/Ruby200-x64/bin/sass:23:in `load'
        from C:/Ruby200-x64/bin/sass:23:in `<main>'

有人有任何想法吗?我们确实需要--watch功能进行本地开发。

2 个答案:

答案 0 :(得分:5)

感谢Jose Gonzalez链接的https://github.com/nex3/sass/issues/1151页面。如该页面所述,修复方法是删除listen v2.7.0 gem并恢复为listen v2.4.1 gem。

在Mac上,使用sudo

为前面的命令添加前缀

所以只需更新到Sass 3.3.0:

gem update sass

检查您是否有更新版本的listen gem,运行:

gem list

如果您有listen v2.7.0 AND v2.4.1,那么您需要卸载较新的listens gem。然后它将使用v2.4.1。

gem uninstall listen --version '2.7.0'

这对我有用。 Sass 3.3.0 --watch命令现在正常运行。

答案 1 :(得分:0)

根据我之前评论中链接的错误报告,似乎已经在Sass v3.3.1中解决了这个问题:

Trouble with 3.3 and --watch #1151