error sqlite3 requires Ruby version >= 1.9.1 - ruby-on-rails

I've used sqlite before. My friend sent me a skeleton rails app that I am trying to run.
When I try to do "rails server" or "thin start" it says
Could not find sqlite3-0.1.1 in any of the sources"
I tried to do bundle install but it throws this error:
Installing sqlite3 (0.1.1) /Library/Ruby/Site/1.8/rubygems/installer.rb:364:in ensure_required_ruby_version_met': sqlite3 requires Ruby version >= 1.9.1. (Gem::InstallError)
from /Library/Ruby/Site/1.8/rubygems/installer.rb:135:ininstall'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/source.rb:96:in install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/installer.rb:55:inrun'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:in each'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/spec_set.rb:12:ineach'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/installer.rb:44:in run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/installer.rb:8:ininstall'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/cli.rb:225:in install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:insend'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/vendor/thor/task.rb:22:in run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/vendor/thor.rb:246:in dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/vendor/thor/base.rb:389:instart'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
I don't know why it's trying to look in the 1.8 folder with Ruby 1.9.2 installed.
What am I doing wrong?

Your bundle command is pointing to your system Ruby, type the following to see which Ruby your Bundler is pointed to: head -1 $(which bundle) Either that needs to be pointed at the Ruby you want to use and/or you need to use the Ruby you want to use to install the Bundler gem (which will put the right shebang line in your bundle executable).

Related

How to fix "can't find executable rails for gem railties. railties is not currently included in the bundle"?

My application server is not starting and giving the error when I am trying to start the server by:
bundle exec rails server -b 0.0.0.0
Traceback (most recent call last):
4: from /root/workspace/abl-rest-client_ruby/local/ruby/2.6.0/bin/ruby_executable_hooks:24:in `<main>'
3: from /root/workspace/abl-rest-client_ruby/local/ruby/2.6.0/bin/ruby_executable_hooks:24:in `eval'
2: from /usr/local/rvm/gems/ruby-2.6.3/bin/rails:23:in `<main>'
1: from /usr/local/rvm/gems/ruby-2.6.3/gems/bundler-2.0.2/lib/bundler/rubygems_integration.rb:480:in `block in replace_bin_path'
/usr/local/rvm/gems/ruby-2.6.3/gems/bundler-2.0.2/lib/bundler/rubygems_integration.rb:460:in
`block in replace_bin_path': can't find executable rails for gem railties. railties is not
currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
I just started working on rails yesterday, so I am too new to the entire concept.
I understand the error that I am missing the railties gem but I am unable to add it.
I have tried uninstalling gems, removing gems, re-installing those, etc. as per the answers to this question 'https://stackoverflow.com/questions/9212116/rails-could-not-find-railties'
but nothing helped.
My gem list has the railties version 6.1.0 but my vendor/cache doesn't have it. I am using windows for the development and I am inside a docker container.
I don't know if not having the railties in my vendor/cache is the problem or I am missing something else.
I have already tried a couple of solutions like specifying my ruby version to rvm
rvm use -myrubyversion, re-starting bundler a couple of times, etc.
Any suggestions?
Make sure your terminal is in the root of the application and not the folder above it. That is, after you run rails new application_name_here enter cd application_name_here to get to the right folder.

no such file to load -- initializer (LoadError)

I have following installed on ubuntu 12
ruby 1.9.2p320
Rails 3.2.6
Now I have old project which is developed into Rails 2 & Ruby 1.8.7
Problem:
When i run below command under old project root directory
ruby ./script/plugin install git://github.com/rails/rails_upgrade.git
Following error comes
Invalid gemspec in [/usr/local/rvm/gems/ruby-1.9.2-p320/specifications/ZenTest-4.9.1.gemspec]: Illformed requirement ["< 2.1, >= 1.8"]
/usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': no such file to load -- initializer (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /var/www/project/client/softwallet/config/boot.rb:54:in `load_initializer'
from /var/www/project/client/softwallet/config/boot.rb:38:in `run'
from /var/www/project/client/softwallet/config/boot.rb:11:in `boot!'
from /var/www/project/client/softwallet/config/boot.rb:109:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from ./script/plugin:2:in `<main>'
Upgrading the old rails project to new one and getting the invalid gemspec problem.
Then you have to do the following:
Run gem update --system followed by bundle install.
UPDATE:
You are using the same old config/boot.rb from your older version of rails application.
Do the following:
1) Create a new project directory.
2) Generate a new rails app (Of your new latest rails version)
3) Use boot.rb that is created by it.
This happens when you have incompatible version of the same gem already installed on your environment.
To rectify, either you can uninstall and reinstall the gem or install the gem of the specific version.
Make sure that you do a gem cleanup operation before doing so.
This is how my problem was solved . I was using RVM and if you have edited those .bashrc files then each time while you log in to the shell , do a /bin/bash --login . What this does is , it makes the command line take note of the rvm path you had set and installs them first .
I did this on Ubuntu 12 and it did solve my issue , i don't think doing gem update --system is a good idea as it really kind of messes up the environment forcing one to do an rvm implode and install it all over again .

RubyGems error after updating system

When trying to launch the rails console after updating my ruby setup using 'sudo gem update --system', I then try execute the rails console by issuing rails c
I get this error:
Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find json (~> 1.4) amongst [Ascii85-1.0.1, abstract-1.0.0, actionmailer-3.1.1, actionmailer-3.1.0, actionmailer-3.0.9, actionmailer-3.0.5, actionmailer-3.0.3, actionpack-3.1.1, actionpack-3.1.0, actionpack-3.0.9, actionpack-3.0.5, actionpack-3.0.3, activemodel-3.1.1, activemodel-3.1.0, activemodel-3.0.10, activemodel-3.0.9, activemodel-3.0.5, activemodel-3.0.3, activerecord-3.1.1, activerecord-3.1.0, activerecord-3.0.9, activerecord-3.0.5, activerecord-3.0.3, activeresource-3.1.1, activeresource-3.1.0, activeresource-3.0.9, activeresource-3.0.5, activeresource-3.0.3, activesupport-3.1.1, activesupport-3.1.0, activesupport-3.0.10, activesupport-3.0.9, activesupport-3.0.5, activesupport-3.0.3, addressable-2.2.6, ansi-1.3.0, arel-2.2.1, arel-2.0.10, arel-2.0.9, arel-2.0.7, bcrypt-ruby-3.0.1, bcrypt-ruby-3.0.0, bcrypt-ruby-2.1.4, builder-3.0.0, builder-2.1.2, bundler-1.0.21, bundler-1.0.18, bundler-1.0.11, choices-0.2.4, cocaine-0.2.0, coffee-rails-3.1.1, coffee-rails-3.1.0, coffee-script-2.2.0, coffee-script-source-1.1.2, devise-1.4.8, devise-1.4.2, erubis-2.7.0, erubis-2.6.6, execjs-1.2.9, execjs-1.2.6, execjs-1.2.4, faraday-0.7.4, faraday-0.6.1, faraday_middleware-0.7.0, faraday_middleware-0.6.3, fastercsv-1.5.4, formtastic-2.0.2, formtastic-1.2.4, geocoder-1.0.4, geocoder-1.0.2, has_scope-0.5.1, hashie-1.1.0, hashie-1.0.0, heroku-2.7.0, hike-1.2.1, i18n-0.6.0, i18n-0.5.0, inherited_resources-1.3.0, inherited_resources-1.2.2, jquery-rails-1.0.16, jquery-rails-1.0.14, kaminari-0.12.4, launchy-2.0.5, libv8-3.3.10.2-x86_64-darwin-10, mail-2.3.0, mail-2.2.19, mail-2.2.15, mail-2.2.14, mechanize-2.0.1, mechanize-1.0.0, meta_search-1.1.1, meta_search-1.0.6, mime-types-1.16, multi_json-1.0.3, multi_xml-0.4.1, multi_xml-0.4.0, multi_xml-0.3.0, multi_xml-0.2.2, multipart-post-1.1.3, multipart-post-1.1.2, mysql-2.8.1, mysql2-0.3.7, mysql2-0.2.7, mysql2-0.2.6, net-http-digest_auth-1.1.1, net-http-persistent-2.1, net-http-persistent-2.0, net-http-persistent-1.9, nokogiri-1.5.0, nokogiri-1.4.4, orm_adapter-0.0.5, pdf-reader-0.10.0, pg-0.11.0, polyamorous-0.5.0, polyglot-0.3.2, polyglot-0.3.1, prawn-0.12.0, rack-1.3.4, rack-1.3.3, rack-1.3.2, rack-1.2.3, rack-1.2.2, rack-1.2.1, rack-cache-1.1, rack-cache-1.0.3, rack-mount-0.8.3, rack-mount-0.6.14, rack-mount-0.6.13, rack-ssl-1.3.2, rack-test-0.6.1, rack-test-0.5.7, rails-3.1.1, rails-3.1.0, rails-3.0.9, rails-3.0.5, rails-3.0.3, railties-3.1.1, railties-3.1.0, railties-3.0.9, railties-3.0.5, railties-3.0.3, rake-0.9.2, rake-0.8.7, rake-0.8.7, rash-0.3.1, rash-0.3.0, rdoc-3.10, rdoc-3.9.4, rdoc-3.9.2, responders-0.6.4, rest-client-1.6.7, rubygems-update-1.8.11, rubygems-update-1.8.10, rubygems-update-1.7.2, rubygems-update-1.7.1, rubygems-update-1.6.2, rubyzip-0.9.4, sass-3.1.10, sass-3.1.7, sass-rails-3.1.4, sass-rails-3.1.2, sass-rails-3.1.0, simple_oauth-0.1.5, sprockets-2.0.2, sprockets-2.0.0, sqlite3-1.3.4, term-ansicolor-1.0.6, therubyracer-0.9.4, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, treetop-1.4.9, ttfunk-1.0.3, ttfunk-1.0.2, turn-0.8.2, twitter-1.7.1, twitter-1.4.1, tzinfo-0.3.30, tzinfo-0.3.29, tzinfo-0.3.26, tzinfo-0.3.24, uglifier-1.0.3, warden-1.0.6, warden-1.0.5, webrobots-0.0.12, webrobots-0.0.11] (Gem::LoadError)
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1932:in `block in traverse'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1931:in `each'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1931:in `traverse'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:465:in `block in find_in_unresolved_tree'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:463:in `reverse_each'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:463:in `find_in_unresolved_tree'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:47:in `require'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.1/lib/rails/script_rails_loader.rb:1:in `<top (required)>'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.1.1/lib/rails/cli.rb:2:in `<top (required)>'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/myusername/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136/gems/rails-3.1.1/bin/rails:7:in `<top (required)>'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136/bin/rails:19:in `load'
from /Users/myusername/.rvm/gems/ruby-1.9.2-p136/bin/rails:19:in `<main>'
Any ideas?
what do you get when you try to list your gems.. is json >= 1.4 there?
e.g.:
> gem list json
*** LOCAL GEMS ***
json (1.6.1, 1.5.4, 1.5.3, 1.5.1, 1.4.2)
json_pure (1.6.1, 1.5.4, 1.5.3)
if you use RVM gemsets, you may want to list them also, to check if your default gemset has changed:
rvm gemset list
EDIT: Mystery Solved! :-)
you accidentially installed your gems with sudo -- but you have RVM installed for your user account!
When you have RVM installed for an individual user, it's generally not a good idea to do sudo gem install ... , but you should install the gems just for the local user and let RVM manage them for whatever Ruby version you are using.
If you still install with sudo, RVM will not find the gems, because they are stored in a different location, outside of RVM, and not searched by RVM...! Looks like that's the case you experienced.
Check this RailsCast: http://railscasts.com/episodes/200-rails-3-beta-and-rvm
if you're using Rails:
- edit your Gemfile and add the json dependency , then run bundle install
if you're just using Ruby by itself, or an old version or Ruby:
- run gem install json in the shell
With newer Ruby versions you should not manually install the gems
Add gem "json", "~> 1.4" in your Gemfile and run bundle install
Also
You only use the sudo command during the install process. In Multi-User configurations, any operations which require sudo access must use the rvmsudo command which preserves the RVM environment and passes this on to sudo. There are very few cases where rvmsudo is required once the core install is completed, except for when updating RVM itself. There is never a reason to use sudo post-install. Once users added to the 'rvm' group have logged out, then back in to gain rvm group membership, rvmsudo should only be needed for updating RVM itself with
rvmsudo rvm get head
Please read the https://rvm.beginrescueend.com/support/troubleshooting/ page The installer page also details this for new installations. You will need to remove your existing installation and redo it in order to properly reconfigure the permissions. In the future, never user sudo when working on your RVM installation, except when installing. Any other commands will not require sudo use except for
rvmsudo rvm get head
to update your installation. If the users are properly placed in the rvm group as detailed on the site, you will have no need to use sudo at all, and rvmsudo only for updating.
Also, RVM does not manage the system installed ruby at all! We do provide the use of
rvm use system
in order to give a natural way to switch between RVM controlled rubies, and the system. Your package manager, or lack thereof for OS X, is responsible for managing your system installed ruby and is outside the control of RVM 100%.

Ruby on Rails issue..mainly dealing with ruby gems/bundler

I was trying to use rspec and for some reason it wasn't working. I think it lacked some dependencies or something. Everything else in Ruby 1.9 was working perfectly on my laptop though. So I did a ruby gems system update (sudo gem update --system). I then did a gem update (sudo gem update). When I tried to run or create apps in rails I get the below listed error message: I also get this same message when I try to do gem update, gem install, gem clean, etc. I am confused. I even tried to update bundler to the latest version but I still get this same error message. I hope someone can help. Thanks.
demetrius-fords-macbook-pro-17:~ demet8$ gem check
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-0.8.1/lib/rubygems_plugin.rb:2:in require': no such file to load -- bundler/commands/bundle_command (LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-0.8.1/lib/rubygems_plugin.rb:2:in'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1113:in load'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1113:inblock in '
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1105:in each'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1105:in'
from :225:in require'
from <internal:gem_prelude>:225:inload_full_rubygems_library'
from :324:in const_missing'
from /usr/local/bin/gem:12:in'
Your backtrace indicates that you're running Bundler 0.8.1. Please uninstall it and make sure you have a more recent version of bundler installed :)

Installing SQLite3 for Ruby on Windows - what's the current easiest route?

Am brand new to Ruby looking to get Redmine to run on WinServer08 sp1
I've read a few threads here detailing the steps and workarounds required to get Ruby and SQLite to play nice with each other.
Ruby will run...sqlite3's .dll and api are in the specified directories...i've rebooted but rake -test fails.
I'd like to find out if there's a definitive step-by-step that rolls up previous workarounds of the various packages involved. - thx much!
C:\Ruby>rake -test --trace
rake aborted!
undefined local variable or method `st' for #<Rake::Application:0x4351638>
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2217:in `standard_rake_opt
ions'
C:/Ruby/lib/ruby/1.8/optparse.rb:1291:in `eval'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2217:in `standard_rake_opt
ions'
C:/Ruby/lib/ruby/1.8/optparse.rb:1291:in `call'
C:/Ruby/lib/ruby/1.8/optparse.rb:1291:in `parse_in_order'
C:/Ruby/lib/ruby/1.8/optparse.rb:1247:in `catch'
C:/Ruby/lib/ruby/1.8/optparse.rb:1247:in `parse_in_order'
C:/Ruby/lib/ruby/1.8/optparse.rb:1241:in `order!'
C:/Ruby/lib/ruby/1.8/optparse.rb:1332:in `permute!'
C:/Ruby/lib/ruby/1.8/optparse.rb:1353:in `parse!'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2313:in `handle_options'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2009:in `init'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio
n_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2007:in `init'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1999:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exceptio
n_handling'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby/bin/rake:19:in `load'
C:/Ruby/bin/rake:19
The Windows version of Ruby on Rails does not ship with the Sqlite3 database, even though the database.yaml configuration file is preconfigured to use Sqlite.
This is a how to guide on how to install Sqlite3 on your Windows PC. This article assumes that you already have Ruby and Ruby on Rails installed on your PC.
First you will need to download two files from the Sqlite web site http://www.sqlite.org/download.html:
sqlite-3_5_9.zip (214.32 KiB)
A command-line program for accessing and modifing SQLite databases.
See the documentation for additional information.
sqlitedll-3_5_9.zip (213.17 KiB)
This is a DLL of the SQLite library without the TCL bindings.
The only external dependency is MSVCRT.DLL.
The first file is the Sqlite command line program used for modifing the Sqlite database. You may or may not use this.
The second file is the Windows DLL library file and Ruby uses this when Rails makes Sqlite database calls.
When both these ZIP files have been extracted you should have the following files:
sqlite3.exe
sqlite3.def
sqlite3.dll
Copy these file to the bin directory of your Ruby installation, if you followed the default Ruby installation it will be located here:
C:\ruby\bin
Now that you have the Sqlite3 files installed you need to tell Ruby how to use them. To do this you need to download the Ruby bindings for Sqlite3.
Fortunately this is easy to do, using Ruby gems. Simply at the command prompt type the following command:
gem install sqlite3-ruby
You will now need to tell Gems which version you need as you will be presented with the following output:
Bulk updating Gem source index for: http://gems.rubyforge.org
Select which gem to install for your platform (i386-mswin32)
1. sqlite3-ruby 1.2.2 (mswin32)
2. sqlite3-ruby 1.2.2 (ruby)
3. sqlite3-ruby 1.2.1 (mswin32)
4. sqlite3-ruby 1.2.1 (ruby)
5. Skip this gem
6. Cancel installation
>_
Please select option 1, sqlite3-ruby 1.2.2 (mswin32). All being successful you will get some output like this:
Successfully installed sqlite3-ruby-1.2.2-mswin32
Installing ri documentation for sqlite3-ruby-1.2.2-mswin32...
Installing RDoc documentation for sqlite3-ruby-1.2.2-mswin32...
If you are using Rails 2+ you should be able to run the following rake tasks from your Rails application directory. For example say you created a Rails application located here: C:\MyApp you should be able to execute:
C:\MyApp>rake db:create
or
C:\MyApp>rake db:migrate
Good luck !
(This was taken verbatim from http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/)

Resources