ruby and gems are installed but sass gem not working

喜你入骨 提交于 2019-12-23 08:55:51

问题


I know I have ruby and gem installed because I've installed a bunch of gems previously. Additionally when I do the following

~$ ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302 [i486-linux]

~$ gem --version
1.3.7

They, as you can see, return the version--yet when I try to do this--

~$ sass --watch happy.scss:happy.css
bash: sass: command not found

I'm a relative noob to everything, but far more to ruby and gems. For the sake of revealing more or less my level of understanding things generally I've learned enough of Debian to get a an environment where I could get Clojure running and get a web app working (taken me almost a year of spare time to do that--I knew virtually nothing of programming previoiusly). I'm trying to get sass working to ease my mental load in the webpage design side of things and I'm just hitting a brick wall on this.

Would this be a PATH issue? If so what needs to be on the path so that one gem works --

BTW here's what happens when I install sass--

# gem install sass
Successfully installed sass-3.2.5
1 gem installed
Installing ri documentation for sass-3.2.5...
Installing RDoc documentation for sass-3.2.5...

Any help anyone can give will be much appreciated. I've been at this one all day and can't figure it out for the life of me.


回答1:


justin ⮀ ~ ⮀ gem install sass  
Fetching: sass-3.2.5.gem (100%)
Successfully installed sass-3.2.5
1 gem installed

justin ⮀ ~ ⮀ sass -v
Sass 3.2.5 (Media Mark)

seems ok to me. I would check your path.

The proper PATH would depend on where your gems get installed. I use RVM so it will be different. You could try to throw an exception in your ruby code with rubygems loaded this should give you a starting point.

> rails c
Loading development environment (Rails 3.2.11)
1.9.3p362 :001 > throw test



ArgumentError: wrong number of arguments (0 for 2..3)
        from (irb):1:in `test'
        from (irb):1
        from /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
        from /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
        from /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
        from script/rails:5:in `require'
        from script/rails:5:in `<main>'

so from that i see /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/gems/railties-3.2.11/lib/rails/commands/console.rb

so my bin path is at /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/bin

and if i

> ls /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/bin

b2json              capify              fog                 html2haml           nokogiri            rails               ri                  sass-convert        therubyracer        tilt
bundle              coderay             geocode             httpclient          oauth               rake2thor           ruby_noexec_wrapper scss                thin                tt
cap                 erubis              haml                j2bson              rackup              rdoc                sass                sprockets           thor

boom sass

so in my case I would want to add /Users/justin/.rvm/gems/ruby-1.9.3-p362@rails3.2/bin

but i use RVM so it does that for me.




回答2:


Try to find out where the Sass got installed. In my case, the gem path is

[~] which gem
/usr/bin/gem

but the Sass got installed in another path that isn't in my $PATH

[~] find . -name '*sass*'
./ruby/gems/doc/sass-3.4.22/rdoc/lib/sass
./ruby/gems/gems/sass-3.4.22/test/sass
./ruby/gems/gems/sass-3.4.22/bin/sass
./ruby/gems/gems/sass-3.4.22/lib/sass
./ruby/gems/bin/sass

So, what I need is adding the $HOME/ruby/gems/bin into my $PATH; then, it fixed the issue.



来源:https://stackoverflow.com/questions/14824965/ruby-and-gems-are-installed-but-sass-gem-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!