Compass no longer working after ruby update - ruby

After installing RVM the other day I can no longer use compass watch as I could.
I've tried updating the system, installing compass again, as well as sass, all to no avail.
Here's the error I get in Terminal:
/Users/john/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler/definition.rb:16:in `build': /Gemfile not found (Bundler::GemfileNotFound)
from /Users/john/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
from /Users/john/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
from /Users/john/.rvm/gems/ruby-2.0.0-p247#global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /Users/john/.rvm/gems/ruby-2.0.0-p247/gems/compass-0.12.2/bin/compass:26:in `<top (required)>'
from /Users/john/.rvm/gems/ruby-2.0.0-p247/bin/compass:23:in `load'
from /Users/john/.rvm/gems/ruby-2.0.0-p247/bin/compass:23:in `<main>'
from /Users/john/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
from /Users/john/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
I've attempted to use bundle update sass-rails per this question, but get the error Could not locate Gemfile
I've also tried to follow the advise here to no avail.
At this point I'm a bit lost. I'm brand new to the Ruby world as well as RVM, and am not the most proficient Terminal user to begin with.
Thanks for any assistance or insight-

/Gemfile not found was a bug in older version of rubygems-bundler gem, run:
rvm #global do gem update rubygems-bundler
and it should work fine

I don't have the answer as to how to fix the problem itself, but I did go through with simply removing it for the time being.
I used rvm implode to remove rvm from my machine per this post.
Everything worked fine after that. Unfortunately that'll delay my experimenting with the Ruby world for a little while longer as I don't have time to figure out how to have RVM without the complications it seemingly brought.
Best,

Related

Rubocop using wrong version of Ruby - Fails

I've re-installed RVM, Ruby and all gems using rvm implode. When I run rubocop, I receive an error that it is using 2.5 (which I did not explicitly install but seems to come with RVM's Ruby 2.5.1)
Note the line I have highlighted with * * - this may be the issue?
$ which ruby
/Users/Will/.rvm/rubies/ruby-2.5.1/bin/ruby
$ rvm use 2.5.1
Using /Users/Will/.rvm/gems/ruby-2.5.1
$ rubocop
Inspecting 604 files
0 files inspected, no offenses detected
Unknown Ruby version: 2.5
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/processed_source.rb:131:in `parser_class’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/processed_source.rb:138:in `create_parser’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/processed_source.rb:94:in `parse’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/processed_source.rb:36:in `initialize’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/processed_source.rb:17:in `new’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/processed_source.rb:17:in `from_file’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:334:in `get_processed_source’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:110:in `block in file_offenses’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:121:in `file_offense_cache’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:109:in `file_offenses’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:100:in `process_file’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:78:in `block in each_inspected_file’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:75:in `each’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:75:in `reduce’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:75:in `each_inspected_file’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:67:in `inspect_files’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/runner.rb:39:in `run’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/cli.rb:82:in `execute_runner’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/lib/rubocop/cli.rb:28:in `run’
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/bin/rubocop:13:in `block in <top (required)>'
*/Users/Will/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/benchmark.rb:308:in `realtime’*
/Users/Will/.rvm/gems/ruby-2.5.1/gems/rubocop-0.49.1/bin/rubocop:12:in `<top (required)>'
/Users/Will/.rvm/gems/ruby-2.5.1/bin/rubocop:23:in `load’
/Users/Will/.rvm/gems/ruby-2.5.1/bin/rubocop:23:in `<main>'
/Users/Will/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval’
/Users/Will/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
Support for Ruby 2.5 was added to Rubocop in version 0.52.0. But you are using 0.49.1.
You need to update Rubocop to at least version 0.52.0 or even better update to the latest version (which is 0.63.1 as of today).
Depending on your setup you simply need to run bundle update rubocop or you might need to specify the desired version in your Gemfile first.
Found this thread when my VScode was looking for rubo cop gem installed within ruby 2.6 when it should have been looking within 2.7.
Not sure if this was the fix or if it was a number of other things but last thing I tried that work was setting the ruby version globally to 2.7
I use rbenv so was able to do rbenv global 2.7.4 and quit/restart vscode and the errors went away.

Padrino Project Generator Fails - Undefined Method `add_builtin_type'

I'm new to both Ruby and Sinatra/Padrino so I apologize if I'm missing something really simple.
I have Sinatra working fine, as I can build a very simple "hello" app and see it work.
I wanted to move on and generate a new Padrino project, but when I do this:
$ padrino g project foobar
I get this:
/Users/dave/.rvm/gems/ruby-2.1.5/gems/activesupport-4.2.0/lib/active_support/ordered_hash.rb:3:in `<top (required)>': undefined method `add_builtin_type' for Psych:Module (NoMethodError)
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
from /Users/dave/.rvm/gems/ruby-2.1.5/gems/padrino-gen-0.12.4/lib/padrino-gen.rb:3:in `<top (required)>'
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/dave/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/dave/.rvm/gems/ruby-2.1.5/gems/padrino-gen-0.12.4/bin/padrino-gen:12:in `<main>'
I have tried installing the Psych gem but this didn't change anything. I have no idea what to try next, or how to really interpret the error message. Any nudges in the right direction you can give me?
Bug reports show this may be an RVM issue.
I suggest changing from RVM to "ruby-install" and "chruby" because IMHO these are simpler, easier, and better at installing dependencies including psych and its libraries.
As joelparkerhenderson noted, the error message shows problems with gem files in the .rvm directory, suggesting some issue or conflict with rvm. Switching to system ruby solved the problem for me. I don't really need to use a specific version of ruby on this project, so that's a fine workaround for me.
I had this problem while using Ruby 2.1.5. After reading comments on here I realized it's not a RVM problem, but a ruby problem. I switched to 2.0.0-p576 and everything works. Psych must not be compatible with the new ruby versions.
However I don't understand how a different ruby version would cause this method to go missing. If anyone could explain that I would be grateful!
I ran into this using rbenv and padrino 0.13.0. Tried many versions of Ruby, including the system Ruby on OS X El Capitan, but found that that made no difference, so I'm now running the latest stable one (2.2.4).
Eventually I tried each version of the psych gem and found I could only get padrino g to work with an older version of the gem. Psych version 2.0.8 worked, while every newer version (up to the current 2.0.16) failed.
So: gem install psych -v=2.0.8 && gem uninstall psych -v '>= 2.0.9'
With me, after a lot of googling and reading various thread on S.O., it was only my rvm that was the problem. I was getting the rvm 'WARNING!' that rvm wasn't first in $PATH. You can check this with echo $PATH. Check out your ~/.bashrc see if there is anything like heroku toolbelt or linuxbrew, or whatever, loading themselves into your PATH at the FRONT i.e. PRE-PENDING your path, rather than APPENDING. This is indicated by something like export PATH="/usr/local/heroku/bin:$PATH". That sets heroku at the beginning of your PATH. Simply change it to export PATH="$PATH:/usr/local/heroku/bin".
I was trying to start a padrino project with activesupport, and this was causing problems. Changing to an earlier version of Ruby, as suggested in another thread, didn't cut it, because activesupport requires 2.2.0 or up.
Fixing my PATH, ensuring that rvm was initialized at the very beginning of the PATH, fixed my Padrino problem, and was able to initialize a project with the following command:
padrino g project sample_blog -t shoulda -e haml -c sass -s jquery -d activerecord -b
I know that's all a little off-tangent, but I think it's bound to help one or two people out there!
PS I'm using ruby 2.2.2p95 in this project folder.

Invalid spec cache file

I have ruby 2.0.0p247 [x64-mingw32] with Gem 2.2.2 installed on Windows 8. I have a persistent problem gem that is making it virtually unusable. Whenever I try to install a new gem, I invariably get:
ERROR: While executing gem ... Invalid spec cache file in C:/Users/...
In the past, I've been able to run gem update or gem update --system and that would clear up the problem for one, single gem install. Subsequent install would fail with the same error. Now even gem update fails with that error message.
I've tried deleting the users/.../.gem directory. When I do that, gem update recreates that directory and promptly fails with the same error message.
I re-installed ruby 1.9.8 with gems several times to try to cure the problem, then upgraded to ruby 2.0.0. Throughout all re-installs and upgrades, the problem persisted.
I'm at my wits end here. Can anyone help me resolve this issue?
Here's the backtrace on the edit"
L:\xampp\htdocs\frameworks\yii2\framework>gem update --backtrace
Updating installed gems
ERROR: While executing gem ... (Gem::Exception)
Invalid spec cache file in C:/Users/Larry/.gem/specs/rubygems.org%443/specs.4.8
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:187:in `rescue in load_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:179:in `load_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:266:in `tuples_for'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:228:in `block in available_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each_source'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:222:in `available_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:102:in `search_for_dependency'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:113:in `fetch_remote_gems'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:135:in `highest_remote_version'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:264:in `block in which_to_update'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:260:in `each'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:260:in `which_to_update'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:96:in `execute'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command.rb:305:in `invoke_with_build_args'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:167:in `process_args'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:137:in `run'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:54:in `run'
C:/Ruby200-x64/bin/gem:21:in `<main>'
I had the same problem, but was able to fix it this way:
Delete the folder in users/%user%/.gem/ and rerun the command gem sources --update
Hope this helps.

Capistrano Using Old Ruby Version

I'm trying to get Capistrano to work on my MacBook (OSX Mountain Lion) but am having a lot of difficulties. It started with it throwing an error:
cillosis:myapp macbook$ cap deploy
/Library/Ruby/Gems/1.8/gems/sshkit-1.2.0/lib/sshkit.rb:32: undefined method `require_relative' for main:Object (NoMethodError)
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/capistrano-3.0.1/lib/capistrano/all.rb:2
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/1.8/gems/capistrano-3.0.1/bin/cap:2
from /usr/bin/cap:19:in `load'
from /usr/bin/cap:19
It seemed I had Ruby 1.8 installed and it doesn't work correctly with Capistrano (found this Googling around).
So I installed Ruby 2.0 using rvm. RVM starting throwing a bunch of errors so I got rid of it using rvm implode and found that the 2.0 version was still on my computer. I checked my $PATH and the locations it pointed at contained the Ruby 1.8. So I renamed that to *ruby_old* and copied the new ruby to that folder (/usr/bin). Then when I did a ruby -v it came back as version 2.0. So I thought, great, now we can finally run Capistrano.
Just to be sure, I did a gem update which came back as having updated the sshkit gem which was throwing the error before. So I go to deploy, and get the same exact error as I started with.
I know the deploy.rb script is correct because I use it all the time on another Mac.
TL;DR; After some fumbling, when I type ruby -v it comes back as using version 2.0 but when I do a cap deploy with Capistrano, it tries to use version 1.8 of ruby. How do I fix this?
The dumb, but simple way out would be to completely remove RVM and both ruby versions, then install again from scratch. I would recommend 1.9.x over 2.0 due to some gems not being up to speed yet, but that's up to you.
Another option would be to specify the ruby version in your gemfile (as heroku does it), then do a "bundle exec cap deploy". Again, no guarantees - but it might force capistrano to behave the way you want until you find a proper solution.

Merb, Bundler, RVM and 1.9.1 = Could not locate Gemfile (Bundler::GemfileNotFound)

Can anyone suggest how to fix this (Ubuntu 9.10):
/home/chris/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.26/lib/bundler/shared_helpers.rb:42:in `default_gemfile': Could not locate Gemfile (Bundler::GemfileNotFound)
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.26/lib/bundler/shared_helpers.rb:51:in `env_file'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.26/lib/bundler.rb:143:in `env_file'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.26/lib/bundler.rb:174:in `update_env_file?'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.26/lib/bundler.rb:95:in `load'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/bundler-0.9.26/lib/bundler.rb:76:in `gem_setup'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/merb-core-1.1.2/bin/merb:10:in `rescue in <top (required)>'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/gems/merb-core-1.1.2/bin/merb:3:in `<top (required)>'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/bin/merb:19:in `load'
from /home/chris/.rvm/gems/ruby-1.9.1-p378/bin/merb:19:in `<main>'
Thank
Chris
Update
I tried really hard to get this to work. Eventually I fell back to merb-core 1.0.12 and that worked fine.
Solution
I needed to write a Gemfile for my application and drop it into the root directory for the app.
I was upgrading across too many versions of Merb! My application was a flat, Rack application originally developed with a much older version of Merb. It didn't have (or need) a Gemfile. When I ran it against the latest Merb, the error was thrown. It would have been better if it said 'I can't find the Gemfile for your application'
I ran merb-gen to get a basic Gemfile and updated it with my own requirements.
Hope that helps someone!
Looks like you need a gem, and a dependency to build that gem.
This might help, it helped me: postgres
(on ubuntu)
sudo apt-get install ruby-full build-essential postgresql-server-dev-8.3 (or 8.4)
sudo gem install postgres
heroku uses postgresql-server-dev-8.3 if you're deploying there.

Resources