Issue with Sass: "Could not find 'sass'" - ruby

I'm trying to get my build flow working, however I cannot seem to get it working. When Sass goes to run after I save a .scss file, I get the following error:
/.rvm/rubies/ruby-1.9.3-p545/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in 'to_specs': Could not find 'sass' (>= 0.a) among 20 total gem(s) (Gem::LoadError)
I'm not entirely sure what else I would need to provide, but hopefully this helps;
The FileWatcher is pointing to /Users/Nick/.rvm/gems/ruby-2.4.2/bin/sass
$ sass -v
Ruby Sass 3.5.6
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
$ which sass
/Users/Nick/.rvm/gems/ruby-2.4.2/bin/sass
$ which ruby
/Users/Nick/.rvm/rubies/ruby-2.4.2/bin/ruby

It turns out the issue was related specifically to High Sierra 10.13 that is a known bug. I updated to 10.13.6 and updated XCode Tools and everything is working as it should.

Related

Github pages installation: Jekyll -v output `require': cannot load such file -- google/protobuf_c (LoadError)

I'm trying to follow this guide on setting up a GitHub page website. I installed Homebrew, chruby, and Jekyll following this jekyllrb.com tutorial.
When I run ruby -v I get ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin18]. When I run chruby -V I get chruby: 0.3.9. After installing Jekyll with gem install jekyll I get Successfully installed jekyll-4.3.1 Parsing documentation for jekyll-4.3.1 Done installing documentation for Jekyll after 0 seconds 1 gem installed.
But when I run jekyll -v (or any Jekyll command) I get a very long message with the following error:
<internal:/Users/my_username/.rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle, 9): no suitable image found. Did find: (LoadError)
/Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle: cannot load 'protobuf_c.bundle' (load command 0x80000034 is unknown)
/Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle: cannot load 'protobuf_c.bundle' (load command 0x80000034 is unknown) - /Users/my_username/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle
I spent hours looking at what this error means and found very specific (to some version of Ruby or other libraries) questions like Ruby 2.7.2 google/protobuf_c problem (M1), Ruby: Gem version 3.11.2 doesn't load on Ruby 2.7, and many others.
It's the first time I even hear about Ruby or Jekyll or anything else here and I can't figure out how to properly install these to just make a website on GitHub. I also tried to install Ruby using rvm instead of chruby but that gave the same error. I also tried to install different versions of Ruby, like 3.1.3 and 3.2.0.
When gems have native extensions that need to be compiled it's possible for the gem author to build the extensions in advance and include them in the package so that the gem can install faster than if it were being compiled from scratch. Unfortunately Google has broken this implementation repeatedly.
This has been a problem for about two years with google-protobuf. Google has periodically fixed it and broken it again. They also periodically claim to understand the problem without understanding it and claim to have fixed it without fixing it. And their GitHub issues frequently pass the buck when they're the only ones that can fix it.
Anytime you're dealing with google-protobuf on macOS it's best to ensure that you are compiling it from scratch. This can be done with the --platform argument:
gem install --platform ruby google-protobuf
The platform ruby means don't use any pre-compiled binaries and force compilation from source.
The platform x86_64-darwin means use the pre-compiled binaries for macOS with Intel processors. That's the version that the gem installer identified for your system and used automatically but the error no suitable image found is a macOS error that means this library was not compiled in a way that I can understand.

How to use Susy2 with Compass / SASS?

I'm trying to figure out how to get Susy2 working alongside compass on my local system, and I've been all over trying to find the answer.
error sass/screen.scss (Line 4 of sass/_base.scss: File to import not found or unreadable: susy.
Load paths:
/Users/jem/Desktop/base/sass
/usr/local/lib/ruby/gems/2.1.0/gems/compass-core-1.0.0.alpha.21/stylesheets
/Users/jem/.compass/extensions/compass-normalize/stylesheets
/Users/jem/.compass/extensions/compass-recipes-master/stylesheets
/Users/jem/.compass/extensions/toolkit/stylesheets
/usr/local/lib/ruby/gems/2.1.0/gems/sassy-maps-0.4.0/sass
/usr/local/lib/ruby/gems/2.1.0/gems/breakpoint-2.4.2/stylesheets
Compass::SpriteImporter
Sass::Globbing::Importer)
ArgumentError on line ["161"] of /usr/local/lib/ruby/gems/2.1.0/gems/sass-3.3.3/lib/sass/error.rb: wrong number of arguments (1 for 2)
Run with --trace to see the full backtrace
I hit this error continually (although occasionally for other gems as well). I feel like I've tried every combination of installing and uninstalling gems, ruby, bundler, etc.
Instructions continually point me toward:
Using Bundler to manage the gems (I am).
Make sure require "susy" is in my config.rb (Yup.)
Make sure I'm on the new alpha version of compass (using 1.0.0.alpha.20)
I'm not having any luck, and I can only assume it's something going on with my local system (OS 10.9, using Ruby 2.1.2 with RVM to stay separate from the system ruby). I had susy working once on a separate linux box, but when I brought the code here I keep running into these susy issues.
If you are using Bundler, your Gemfile should include:
gem "susy", "~>2.1.0"
gem "sass", "~>3.3.0"
gem "breakpoint", "~>2.4.0"
Bundler should set up all the other dependencies you need.
Since you are using RVM for your Ruby installation, are you sure that you are using the default Ruby (as per RVM) or the system Ruby which might be only Ruby 1.8.7 (rather than Ruby 2.0)?

How do I specify which gem to use when using rbenv. Multiple versions same gem installed

I've been using Sass 3.2.13.
I want to try out the sourcemap generation in 3.3, so I installed 3.3.
'gem list | grep sass' returns
sass (3.3.0.rc.5, 3.2.14)
I would like to invoke sass 3.3 from the commandline. I'm not using sass from a within a ruby project.
I discovered that format should work:
gem_name __versionNum__ --opts
So, I've tried this:
sass _3.3.0.rc.5_ --watch --sourcemap sass/site.sass: css/site2.css
The resulting stack trace returns
"Could not find sass (= 3.3.0.rc.5)..."
I've tried variations, like 3.3.0, 3.3, but these return stack traces with the same message about not being able to find the specified version.
Turns out that I was calling the wrong 'sass' binary.
Instead of using my rbenv gem, I was using 'sass' from '/usr/local/bin'.
I've deleted system sass. Now when I call 'sass' I get the version offered by the gem I installed via rbenv.
Yes, I know I shouldn't be deleting system binaries. It's a dirty, dirty thing to do. In the desperate case of removing system ruby from ubuntu, I think the measure is justifiable.

After freshly installing compass-inuit we get an error while starting up "compass watch"

We just created an compass project like described in the compass-inuit manual.
When we now start "compass watch" we get the following error message:
user#VirtualXubuntu:/tmp/compass-test/my_project$ compass watch
>>> Change detected at 12:23:22 to: sass/style.scss
error sass/sass/style.scss (Line 99: Invalid CSS after "}​": expected "{", was "")
identical stylesheets/sass/style.css
>>> Compass is polling for changes. Press Ctrl-C to Stop.
Actually I don't know what this error means - since I'm a newbie in compass...
Version Info:
Ubuntu 12.10 [amd64]
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Compass 0.12.2 (Alnilam)
This has been fixed in a newer version of the extension. Update by running gem install compass-inuit -v 4.5.5.1, then make a new project by running:
compass create my_project -r compass-inuit --using compass-inuit
I believe the cause of this error is one of the brackets isn't really a bracket but a pasted character. This causes the compiler to miss it and believe that a selector isn't closed.
Sorry for the hassle.

Rspec bundle is broken in TextMate and rvm

I've had a difficult time since I started using rvm. I've done all the rvm/textmate set up and have the latest bundles but I still can't run Rspec test from textmate.
I have the latest bundle from github.com/rspec/rspec-tmbundle.git
and it's installed in ~/Library/Application\ Support/TextMate/Bundles/
RSpec.tmbundle
RVM default is using the system ruby 1.8.6
Rspec gem versions
gem list --local | grep spec
blue_light_special (0.2.0)
rspec (2.2.0)
rspec-core (2.2.1, 2.0.1)
rspec-expectations (2.2.0, 2.0.1)
rspec-mocks (2.2.0, 2.0.1)
rspec-rails (2.0.1, 1.3.2)
TextMate
TM_RUBY=/Users/jspooner/.rvm/bin/rvm-auto-ruby
The Error: rspec/core (LoadError)
/Users/jspooner/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/rspec/mate.rb:29:in require': no such file to load -- rspec/core (LoadError) from /Users/jspooner/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/rspec/mate.rb:29 from /tmp/textmate-command-8073.rb:2:inrequire' from /tmp/textmate-command-8073.rb:2
The best solution I've found is from Jacques Crocker.
http://groups.google.com/group/rubyversionmanager/browse_thread/thread/64b84bbcdf49e9b?fwc=1
It requires replacing the contents of textmate_ruby with the code below and never running rvm wrapper xxx textmate again.
#!/usr/bin/env sh
source ~/.rvm/scripts/rvm
cd .
exec ruby "$#"
This has also fixed the same issue with the cucumber bundle.
Did you try following the instructions here: http://rvm.io/integration/textmate/
My case is slightly different but took me more than an hour to figure out:
Turns out I ran rvm wrapper ree textmate a while after installing ree with rvm and in the mean time the ree shorthand changed from meaning ree-1.8.7-2010.01 to ree-1.8.7-2010.02
here's more details on my message:
https://gist.github.com/721987
I'm posting it here too because it's one of the first pages I landed onto while trying to figure this one out.
I've got a similar problem and figured out that my textmate ruby wrapper is pointing to a different version. I was able to get it work by putting below content in projectx/.rvmrc
rvm 1.9.2#projectx --create
rvm wrapper 1.9.2#projectx textmate
Hope this helps.

Resources