I have spent over 5 hours trying to solve this and feel that since I haven't done it before I should ask some help now...
I have a site I inherited with Sass/Compass put together. I have it set up on my localhost and it works fine for that site.
I have a second localhost site I want to use it on. So I went to the theme folder in terminal - (/sites/all/theme/newtheme/) I tried to start watching a sass folder with compass and keep getting these errors...
/Library/Ruby/Site/1.8/rubygems/dependency.rb:298:in `to_specs': Could not find 'compass'
(>= 0) among 12 total gem(s) (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:309:in `to_spec'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /usr/bin/compass:18
I am using rvm rubies 1.9.3 and sass/compass have been installed. I have searched and tested many ideas and I am lost as to what to do. I really want to get into sass but I am losing out with timing to get into it and need to solve this issue. I would love any help you can give and will research and test anything.
Update: I am using rvm and I am using ruby-1.9.3-p484.Here is my gem list.
LOCAL GEMS
bigdecimal (1.1.0)
bundler (1.5.3)
bundler-unload (1.0.2)
celluloid (0.15.2)
chunky_png (1.3.0)
ompass (0.12.2)
executable-hooks (1.3.1)
ffi (1.9.3)
fssm (0.2.10)
gem-wrappers (1.2.4)
io-console (0.3)
json (1.5.5)
listen (2.4.1)
minitest (2.5.1)
rake (0.9.2.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.3)
rdoc (3.9.5)
rubygems-bundler (1.4.2)
rvm (1.11.3.9)
sass (3.3.0.rc.4, 3.2.14, 3.2.13)
timers (1.1.0)
When I run $compass -v, or $compass watch I get this error.
ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- sass/script/node (LoadError)
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass.rb:4:in `each'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
gems/ruby-1.9.3-p484@global/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
rubies/ruby-1.9.3-p484/bin/compass:23:in `load'
rubies/ruby-1.9.3-p484/bin/compass:23:in `<main>'
gems/ruby-1.9.3-p484@global/bin/ruby_executable_hooks:15:in `eval'
gems/ruby-1.9.3-p484@global/bin/ruby_executable_hooks:15:in `<main>'
One thing I think is the path to compass. However when I try to use ruby-1.9.3-p484@global I get the same results.
I have been searching, testing, installing and uninstalling to try to figure out the one step I am missing. Please share any ideas. Thanks
You need to uninstall sass and reinstall it with the following:
gem uninstall sass
gem install sass --no-ri --no-rdoc
gem install compass --no-ri --no-rdoc
This somewhat goes along with @user24793's answer to himself, but I just had this exact same issue happen out of absolute no where for a local dev environment that was working fine a few days ago, except my issue was with sass rather than compass. I am also using RVM, and the other answers here didn't help me either.
What happened in my case was while my main version of ruby is 2.1.5 and my gem path was located at ~/.rvm/gems/ruby-2.1.5
, there was a secondary version of ruby installed in a subdirectory of my main ruby that was looking in ~/.rvm/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0
which predictably didn't have sass in it. I'm not sure when this happened as it was working fine last week, and it appeared to only have affected this one project.
I'm no Ruby expert, so after doing a ton of searching I was able to find other threads similar but with other answers, one such thread being Rails: Could not find railties. Highlights from that one that coincidentally did not work for me but seem promising are:
rvm reinstall X.X.X
X's being whatever version you're using, then gem install {gem}
. I've got a ton of projects at the moment so I wasn't able to try this one myself, but after I finish my active projects I'm probably going to give this a go.rvm implode
however this will force you to do a complete reinstall of rvm. Again, too many projects to try at the moment.Since I've now been halted on this project for the last 3 days because of this, I don't have a gemrc file, nothing I could find actually worked, and it seems like it's ultimately just an incorrectly installed version of ruby that got added by this project, I had to take drastic measures by forcing the gem path for the secondary ruby to the correct gem path.
I don't recommend this as a solid way around the problem, but if you're blocked on a project because of this, don't have a gemrc file or any way of changing the path of a ruby version that was installed inside of a ruby version, this works as a bit of a hack but I highly suggest after you finish your project you try reinstalling rvm/ruby and doing more research.
Anyway, I'm sure there's another way around this where you can get into the cli for the alternate ruby and change the gem path, but I wasn't able to find one and I needed this fixed asap. I would be extremely happy if someone could let me know how that is possible, but otherwise you have to find your defaults.rb
file, which I found at:
~/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/defaults.rb
On line 75 it defines the users home directory gem path, and on line 93 it defines the default gem path. The users home directory gem path wasn't even an existing folder, so I swapped it from:
def self.user_dir
parts = [Gem.user_home, '.gem', ruby_engine]
parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
File.join parts
end
To:
def self.user_dir
parts = [Gem.user_home, '.rvm/gems/ruby-2.1.5']
File.join parts
end
This instantly fixed my problem; but again my circumstances are very rare and I only recommend doing this if you've got no other alternative and are dealing with a secondary version of ruby that has no gemrc file or command line that you can tap into.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With