Rails rack 1.0 error - ruby-on-rails

I have this error when I try to start script/server:
/opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems.rb:827:in `report_activate_error': RubyGem version error: rack(1.0.0 not ~> 1.0.1) (Gem::LoadError)
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems.rb:261:in `activate'
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems.rb:68:in `gem'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller.rb:34
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
from /opt/ruby1.8/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:2
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/ruby1.8/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
It's very annoying because, I did:
Successfully installed rack-1.1.0
1 gem installed
Installing ri documentation for rack-1.1.0...
Installing RDoc documentation for rack-1.1.0...
But it always says that error. I have Rails 2.3.5 but I don't think the error is Rails related, but more like my server-related lol.
Thanks for help!

You installed Rack 1.1.0, the version required is 1.0.x.
$ gem uninstall rack
$ gem install rack -v 1.0.1

the above works, when installing, you have to indicate the version: "-v 1.0.1"
for some reason, it wont work otherwise.

Related

can't find gem bundler Ruby

Using Mac OS 13, rbenv.
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
Rails 5.1.4
Bundler version 1.16.1
rbenv 1.1.1
I'm trying to start a new Rails application and then getting this:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem bundler (>= 0) (Gem::GemNotFoundException)
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/generators/app_base.rb:382:in `bundle_command'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/generators/app_base.rb:416:in `run_bundle'
from (eval):1:in `run_bundle'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `block in invoke_all'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `each'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `map'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:133:in `invoke_all'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/group.rb:232:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/application/application_command.rb:24:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/lib/rails/cli.rb:16:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Library/Ruby/Gems/2.3.0/gems/railties-5.1.4/exe/rails:9:in `<top (required)>'
from /usr/local/bin/rails:22:in `load'
from /usr/local/bin/rails:22:in `<main>'
As I understand it has something to do with a version of Ruby but I have no idea how to resolve the issue.
It looks like you may need to do a gem install bundler and get the bundler gem to get rails up and running.
STEP (1): install the bundler gem:
sudo gem install bundler
Once completed, you should get a message similar to this:
Fetching: bundler-1.16.1.gem (100%)
Successfully installed bundler-1.16.1
Parsing documentation for bundler-1.16.1
Installing ri documentation for bundler-1.16.1
Done installing documentation for bundler after 6 seconds
1 gem installed
STEP (2): try checking the bundler version:
bundle -v
You should get a version number like this:
Bundler version 1.16.1
STEP (3): now you can use bundle install:
bundle install
I hope my answer helps.

not able to login heroku

i was trying to login to heroku to push my app and until yesterday it was working but now it is giving me errors related to json version.
this is the log created after command heroku login
This is the legacy Heroku CLI. Please install the new CLI from https://cli.heroku.com
c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:2275:in `check_version_conflict': can't activate json-1.8.2, already activated json-1.8.3 (Gem::LoadError)
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/specification.rb:1404:in `activate'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:89:in `block in require'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:88:in `each'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:88:in `require'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/heroku-3.99.1/lib/heroku/cli.rb:16:in `<top (required)>'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from c:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/heroku-3.99.1/bin/heroku:24:in `<top (required)>'
from c:/RailsInstaller/Ruby2.3.0/bin/heroku:22:in `load'
from c:/RailsInstaller/Ruby2.3.0/bin/heroku:22:in `<main>'
my ruby version is 2.3.3 and rails 5.0.3
Thank you
`check_version_conflict': can't activate json-1.8.2, already activated
json-1.8.3 (Gem::LoadError)
This is due to bundler trying to install json-1.8.2 when there is json-1.8.3 already installed. This is because bundler will use Gemfile.lock to install specified gem versions of gems.
You should do gem cleanup and followed by gem update json. This will update the json to latest version in Gemfile.lock and will resolve the problem.

Could not railties in mac os

I had recently followed multiple blogs to completely wipe out rvm, rails and then reinstalled ruby 2.3.0 and rails 5. Made and app using it no issues. But the moment I opened a new terminal window in my machine it was not recognising rails at all as if it was only installed in that particular terminal.
So I just completed my work in that single terminal. Now when I restarted my laptop, I am unable to run the same app. I do not wish to reinstall everything again as I am sure this is a small configuration problem. Why is this happening?
The error message that I am getting now:
/Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'railties' (>= 0.a) among 30 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/sahil/.rvm/gems/ruby-2.3.1:/Users/sahil/.rvm/gems/ruby-2.3.1#global', execute `gem env` for more information
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /Users/sahil/.rbenv/versions/2.3.1/bin/rails:22:in `<main>'
I have already seen other similar questions where they ask to reinstall everything again which I do not want to do as it worked after installing but did not work on system restart.
Now I did gem install rails in one terminal and the app is working again, but if I try to open a new terminal and give the same command rails s, it gives me this error,
Ignoring byebug-9.0.5 because its extensions are not built. Try: gem pristine byebug --version 9.0.5
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
Ignoring nokogiri-1.6.8 because its extensions are not built. Try: gem pristine nokogiri --version 1.6.8
Ignoring byebug-9.0.5 because its extensions are not built. Try: gem pristine byebug --version 9.0.5
Ignoring debug_inspector-0.0.2 because its extensions are not built. Try: gem pristine debug_inspector --version 0.0.2
/Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /Users/sahil/.rvm/gems/ruby-2.3.1#global/gems/io-console-0.4.6/lib/io/console.bundle (fatal)
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/user_interaction.rb:9:in `<top (required)>'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/config_file.rb:8:in `<top (required)>'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rvm/gems/ruby-2.3.1#global/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:4:in `<top (required)>'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rvm/gems/ruby-2.3.1#global/gems/bundler-1.12.5/lib/bundler/shared_helpers.rb:6:in `<top (required)>'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/sahil/.rvm/gems/ruby-2.3.1#global/gems/bundler-1.12.5/lib/bundler/setup.rb:2:in `<top (required)>'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /Users/sahil/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Users/sahil/Documents/work/Development/todoApp/config/boot.rb:3:in `<top (required)>'
from bin/rails:3:in `require_relative'
from bin/rails:3:in `<main>'
You mentioned that you reinstalled ruby 2.3.0 and Rails 5. However it seems rbenv is trying to load your project with ruby 2.3.1.
You should switch to ruby 2.3.0. I guess you should be able to do: rbenv local 2.3.0.
To avoid this from happening again though, you should add a .ruby-version dotfile to your project root and in the file only add 2.3.0.
Hope that works

create spree extension unable to activate rails-3.2.4 - activesupport version conflicts

I'm a newbie to Ruby/Rails/Spree and am trying to follow this tutorial to create a simple spree extension.
I enter this command:
spree extension simple_sales
and cd into spree_simple_sales
Any rails command I type now within this directory (eg. rails -v) results in this error:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate rails-3.2.4, because activesupport-4.0.0 conflicts with activesupport (= 3.2.14), actionpack-4.0.0 conflicts with actionpack (= 3.2.14), railties-4.0.0 conflicts with railties (= 3.2.14), activerecord-4.0.0 conflicts with activerecord (= 3.2.14), actionmailer-4.0.0 conflicts with actionmailer (= 3.2.14) (Gem::LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `activate'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:212:in `rescue in try_activate'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems.rb:209:in `try_activate'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from D:/Dev/Tests and Tutorials/rails/extensions/spree_simple_sales/lib/spree_simple_sales/engine.rb:3:in `<class:Engine>'
from D:/Dev/Tests and Tutorials/rails/extensions/spree_simple_sales/lib/spree_simple_sales/engine.rb:2:in `<module:SpreeSimpleSale>'
from D:/Dev/Tests and Tutorials/rails/extensions/spree_simple_sales/lib/spree_simple_sales/engine.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine/commands.rb:11:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from script/rails:7:in `<main>'
What can I do to fix this? I am on Win 7, have used RailsInstaller to install Ruby 1.9.3. I have both Rails 4.0.0 and 3.2.14 but am using Rails 3.2.14 with Spree.
UPDATE
I discovered if i add bundle exec in front of rails command eg. bundle exec rails -v it works .. but any rails command without bundle exec generates the above error.. but WHY? And why is this issue only happening that spree extension generated directory?
Your error is likely because the rails command you are executing is Rails 4, and the Gemfile and/or gemspec that you're using in your extension specifies rails 3.2.x (or vice-versa).
Try running the same command with:
rails _3.2.4_ -v
in that directory.
Also note, Rails 3.2.4 is quite out of date with several security vulnerabilities. You should upgrade as soon as possible.

rails console error readline load error

I'm having problem with the rails console. It gives me this error when I try installing the readline module using:
yum install readline-devel
I'm working with Rails 3.1.1 on a fedora 14 machine.
/home/led/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /home/led/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/led/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/console.rb:3:in `require'
from /home/led/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/led/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:37:in `require'
from /home/led/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
ADDITION:
i tried installing readline via rvm following this link
[readline install via rvm][1]
and rails c worked but the problem is when reboot my system and tried again it appears to show this error
/usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find rack (~> 1.2.1) amongst [ParseTree-3.0.5, RubyInline-3.8.4, ZenTest-4.3.3, abstract-1.0.0, actionmailer-3.0.5, actionpack-3.0.5, activemodel-3.0.5, activerecord-3.0.5, activeresource-3.0.5, activesupport-3.0.5, arel-2.0.9, builder-2.1.2, bundler-1.0.10, cgi_multipart_eof_fix-2.5.0, daemons-1.0.10, diff-lcs-1.1.2, erubis-2.6.6, fastthread-1.0.7, gem_plugin-0.2.3, git-1.2.5, i18n-0.6.0, i18n-0.5.0, json-1.4.6, mail-2.3.0, mime-types-1.17.2, mime-types-1.16, mongrel-1.1.5, mongrel_cluster-1.0.5, multimap-1.1.2, mysql-2.8.1, mysql2-0.3.7, polyglot-0.3.2, polyglot-0.3.1, rack-1.3.5, rack-1.1.0, rack-mount-0.8.3, rack-mount-0.6.13, rack-test-0.6.1, rack-test-0.5.4, rails-3.0.5, railties-3.0.5, rake-0.9.2.2, rake-0.9.2, regin-0.3.8, regin-0.3.7, rspec-core-2.6.4, rspec-expectations-2.6.0, rspec-mocks-2.6.0, ruby2ruby-1.2.4, ruby_parser-2.0.4, sexp_processor-3.0.4, sqlite3-1.3.3, text-format-1.0.0, thor-0.14.6, treetop-1.4.10, treetop-1.4.9, tzinfo-0.3.30, tzinfo-0.3.26] (Gem::LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:761:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:758:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:758:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:742:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:764:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:758:in `each'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:758:in `activate_dependencies'
from /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:742:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1211:in `gem'
from /usr/bin/rails:18
You need to install readline headers and libraries prior installing the Ruby interpreter (it is shown once you complete the installation of RVM)
You can see that again doing rvm notes
Check that the readline gem is installed. The above yum command installs the readline library, but to interact with it, you need the gem.
If it's not in your Gemfile, add it, run bundle install and check again.

Resources