Sass issue when i use the --watch parameter

2020-04-05 19:17发布

When i execute the line

$sass --watch sass/views.scss:views.css

i get the following message

Sass is watching for changes. Press Ctrl-C to stop. NameError: uninitialized constant Listen::MultiListener Use --trace for backtrace.

As you can say the process stops immediately and the watch option doesn't work.

What's the problem here ?? I have installed the Ruby 2.0.0-p0 version.

Any help appreciated.

EDIT: (--trace)

Sass is watching for changes. Press Ctrl-C to stop. /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/plugin/compiler.rb:266:in watch': uninitialized constant Listen::MultiListener (NameError)
from /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/plugin.rb:107:in
method_missing'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/exec.rb:452:in watch_or_update'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/exec.rb:315:in
process_result'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/exec.rb:41:in parse'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/lib/sass/exec.rb:21:in
parse!'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/gems/sass-3.2.8/bin/sass:9:in <top (required)>'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/bin/sass:23:in
load'
from /home/javier/.rvm/gems/ruby-2.0.0-p0/bin/sass:23:in `'

标签: sass
4条回答
Luminary・发光体
2楼-- · 2020-04-05 19:53

I tried these answers and none worked, so i did some more research. Apparently, the problem is with the listen gem that SASS is using. Sass is only compatible with listen 0.7.

I was able to get it working by running the following two commands (as root):

gem uninstall listen
gem install listen -v 0.7.3
查看更多
聊天终结者
3楼-- · 2020-04-05 19:59

I had the same issue. You just need to run the command in sudo mode.

sudo sass --watch sass/views.scss:views.css
查看更多
我想做一个坏孩纸
4楼-- · 2020-04-05 20:09

I fixed it by uninstalling the original sass I had installed using apt-get (ruby-sass) and reinstalled using gem

查看更多
贼婆χ
5楼-- · 2020-04-05 20:14

Well i fix my problem updating the sass gem to the latest version (3.2.9). I think that this update provide better compatibility with Ruby 2.0.0 when using he --watch parameter. Everything works great now.

查看更多
登录 后发表回答