Sass 3.3.0 'NoMethodError' - 使用 '--watch' 时出错



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

没有——跟踪:

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

,跟踪
C:RemoteProjectssass-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特性用于本地开发。

感谢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和v2.4.1,那么你需要卸载新的listens gem。然后它将使用v2.4.1。

gem uninstall listen --version '2.7.0'

这对我有用。Sass 3.3.0 --watch命令现在可以正常工作了

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

3.3和——watch #1151的问题

最新更新