I'm a beginner programmer and I'm trying to run the Rails Server through my command line. I type in "rails server" in my command line, and receive this error:
Could not find gem 'sqlite3-ruby (= 1.2.5, runtime)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
After receiving this error, I run 'bundle install'. Once I run 'bundle install', I type in "rails server" in my command line and receive the same error:
Could not find gem 'sqlite3-ruby (= 1.2.5, runtime)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
Here's a copy of my GemFile:
source 'http://rubygems.org'
gem 'rails', '3.0.9'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
Can someone help me get my rails server up and running? Thanks!
try deleting the "1.2.5" in your gemfile so the line looks like:
gem 'sqlite3-ruby', :require => 'sqlite3'
then run
bundle install
again
I think I once got this error a long time ago - it had something to do with having sqlite.dll in my bin or lib folder in my computer's ruby dir or something like that. I think Michael Hartl's tutorial mentions something about it.
Have you tried just
gem 'sqlite3'
You might also want to confirm that your gem is properly installed in your environment:
gem list
You can also get more information about a specific gem:
gem specification sqlite3-ruby
I am assuming that you have no issues with installing other gems - that is, you don't need to set up a http_proxy environment variable for bundle install.
Related
I'm doing some work with an old code base that was running Ruby 1.9.3 and Rails 3.2.3. However, I had to update to Ruby 2 (I chose 2.1.5, because I've used it in the past) to fix an SSL error that arose when using the PayPal API (my task was to implement PayPal for credit card processing). This caused an error with the asset pipeline, and after some investigation I discovered that Rails 3.2.3 didn't support Ruby 2.1.5, so I had to upgrade to Rails 3.2.19.
Everything was working fine on my local machine. When it came time to deploy, I installed rbenv on the server (it didn't have RVM or rbenv) and installed Ruby 2.1.5.
Now, the deploy script gets past bundle install, but when it tries to execute cd /var/www/cappwww/current && RAILS_ENV=production script/delayed_job stop, it chokes and says Could not find *** in any of the sources (Bundler::GemNotFound).
"***" is just a placeholder; this happened first with i18n, then multi_json. I manually changed the requested versions of these gems and ran bundle update, and it seemed to work. However, it is now requesting activesupport 3.2.3, and I can't force it to use that because Rails 3.2.19 requires activesupport 3.2.19.
As far as I can tell, this isn't an issue of delayed_job actually requiring these gems, because 1) they would be installed during bundle install, or bundle install would complain if there was an unresolvable dependency, and 2) delayed_job requires activesupport >= 3 according to rubygems, so 3.2.19 should do just fine.
It seems that for some reason, the delayed_job script is looking for a very specific gemset, specifically the old gemset. However, I have no idea what could be causing it to do that.
My Gemfile is
source 'http://rubygems.org'
gem 'rake', '10.1.1'
gem 'rmagick'
gem 'rails', '3.2.19'
gem 'devise', '2.0'
gem 'haml', '3.1.4'
gem 'sass', '3.2.3'
gem 'formtastic', '2.1.0.rc'
gem 'cocaine', '0.3.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'mysql2', '0.2.6'
gem 'mysql2', '0.3.11'
#gem 'less', '~> 2.0.8'
gem 'less', '~> 2.2.1'
gem 'tinymce-rails', '3.5.8'
gem 'will_paginate', '3.0.3'
gem 'country_select', '1.0.1'
gem 'paypal-sdk-rest'
# Use unicorn as the web server
gem 'unicorn'
gem 'jquery-rails', '2.1.4'
gem 'paperclip', '3.2.1'
gem 'feedzirra', '0.0.24'
gem 'delayed_job', '4.1.0'
gem 'delayed_job_active_record', '4.1.0'
gem 'daemons', '1.1.9'
gem 'therubyracer', '0.12.0'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
gem 'rsolr', '1.0.7'
gem 'sunspot', '1.3.3'
gem 'sunspot_solr', '1.3.3'
gem 'sunspot_rails', '1.3.3'
gem 'hpricot', '0.8.6'
gem 'roadie', '2.3.4'
group :assets do
gem 'sass-rails'
gem 'uglifier'
end
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development, :test do
# Deploy with Capistrano
gem 'capistrano', '2.13.5'
gem 'capistrano-rbenv'
gem 'rspec-rails', '~> 2.6'
gem 'machinist', '2.0'
gem 'faker', '1.0.1'
gem 'syntax', '1.0.0'
gem 'progress_bar', '0.4.0'
end
group :development do
gem 'active_record_query_trace', '1.1'
end
Any help would be greatly appreciated, as I'm in pretty far over my head.
Well, I figured it out. The RAILS_ENV=production script/delayed_job stop command was executing in the current folder, which is the previous release. Since I was using rbenv to force Ruby 2.1.5, the gems for the previous release had not been installed for the current version of Ruby, which is why delayed_job was complaining. Running bundle install in the current directory fixed the issue.
Here is a link to my screen cap. http://imgur.com/bbLud (SO doesn't allow noobs to post pics)
The problem.
Trying to bundle install and it keeps throwing the 'this version requires a different version of bundler' error. So I uninstall the current version, check my versions of bundler and it still appears. I go to uninstall it again and it tell me it doesn't exist. Can someone please lend a thought.
EDIT: Contents of Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3-ruby', '1.0.0', :require => 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
Try to manually install bundler 1.0.0 using gem install bundler --version "1.0.0" and then run again bundle install.
UPDATE: Looking at the screenshot in the other answer it seems you already have bundler 1.0.0, BTW give it a try anyway. It seems the bundle command still points to the newer version, what do you get if you run bundle -v?
The error is at it says in the screenshot, you are using rails 3.0.1.
do uninstall without version
gem uninstall bundler
it will ask you which version you want to remove then remove it, select 1.3.1 to uninstall, do a bundle install again and if it still shows error post it back here.
I've deployed my app to a remote machine using Capistrano and Passenger. The project is on GitHub, and I want to work on some bug fixes on my local machine. I've synced up everything, and branched to a new 'dev' branch on my local machine. When I try the simple rails server command I had been using while developing, I get errors relating to the gems bundled in my Gemfile, e.g. `require': no such file to load -- nokogiri/nokogiri (LoadError). But when I run bundle show nokogiri, it's present at /vendor/cache/ruby/1.9.1/gems/nokogiri-1.5.0.
Maybe this is just the wrong workflow entirely, but how do I get to a development mode on my local machine, so I can test changes before pushing them to the deployed app?
My Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.0.10'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'nested_scaffold'
gem 'rest-client'
gem 'pony'
gem 'mail'
gem 'logger'
gem 'json'
gem 'gmail'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
I suggest you delete .bundle directory (consider backing up whatever's inside .bundle/config first) and run your bundle install command again. You can do cat .bundle/config to echo its contents to your terminal (STDOUT).
Make sure you have chosen the correct gemset by doing rvm gemdir and gem list to see all the gems in the current gemset.
Start your server with rails s -e development (s is short for server)
I ran a bundle install on my Gemfile recently, and tried to rake:db:migrate. This migration didn't work, and outputs:
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method SampleApp::Application#task called at /Users/joshuaballoch/.rvm/gems/ruby-1.9.2-p180#rails3tutorial3/gems/railties-3.0.3/lib/rails/application.rb:214:in `initialize_tasks'
I read on another post that I should uninstall 0.9.1, but for some reason some gem I have requires 0.9.1 after the uninstall, so I don't know how to fix this. Any suggestions?
FYI my gemfile is:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
gem 'gravatar_image_tag', '1.0.0.pre2'
gem 'will_paginate', '3.0.pre2'
group :development do
gem 'rspec-rails', '2.3.0'
gem 'annotate-models', '1.0.4'
gem 'faker', '0.3.1'
end
group :test do
gem 'rspec', '2.3.0'
gem 'webrat', '0.7.1'
gem 'factory_girl_rails', '1.0'
end
Have you tried running it like so: bundle exec rake db:migrate
the bundle exec command runs your request in the environment defined by the bundle, so if your global gems differ this may help.
If not, you can add gem "rake", "0.8.7" to your gemfile, bundle install then try again. Your other dependency should still be met as you aren't removing 0.9.1, just asking bundle exec to use a different version.
Rails 3.0.8 was released yesterday, and includes "Fixing Rake 0.9.x integration". Worth a try.
I have a small web app, which uses a bunch of gems. Some of them are only used for test and development environments. Now, when I try to start unicorn on the production server using the following command, it fails.
unicorn_rails -E production -D -c config/unicorn.rb
The error I see in the log files is:
Refreshing Gem list
Could not find gem 'spork (>= 0.9.0.rc2, runtime)' in any of the gem sources listed in your Gemfile.
Try running `bundle install`.
I've pasted my gemfile below:
source 'http://rubygems.org'
gem 'rails', '3.0.1'
gem 'unicorn'
gem 'mongoid', '>= 2.0.0.beta.19'
gem 'devise'
gem 'cancan'
gem 'haml', '>= 3.0.0'
gem 'bson'
gem 'bson_ext'
gem 'formtastic'
gem 'bluecloth'
group :production do
gem 'capistrano'
end
group :development do
gem 'haml-rails'
gem 'hpricot', '0.8.2'
gem 'ruby_parser', '2.0.5'
gem 'less'
gem 'rspec-rails', '>= 2.0.1'
end
group :development,:test do
gem 'spork', '>=0.9.0.rc2'
gem 'mongoid-rspec'
end
group :test do
gem 'factory_girl_rails'
gem 'autotest'
gem 'cucumber-rails'
gem 'cucumber'
gem 'capybara'
gem 'shoulda'
gem 'database_cleaner'
gem 'test_notifier'
gem 'rspec', '2.0.1'
gem 'launchy'
end
Bundler is supposed to detect the right environment and ignore the other gems, right? Right now, I am deleting all the lines which are not in the default group on the server to get this working, but that's an ugly hack.
After a lot of digging I found the fix for this issue. All I had to do was run bundle install --without development test before starting the server. This adds a .bundle/config file in the rails root with the line BUNDLE_WITHOUT: test:development . Now whenever you run bundle install or start the server it'll ignore those groups.
From the documentation
The Bundler CLI allows you to specify
a list of groups whose gems bundle
install should not install with the
--without option. To specify multiple groups to ignore, specify a list of
groups separated by spaces.
bundle install --without test bundle
install --without development test
After running bundle install --without
test, bundler will remember that you
excluded the test group in the last
installation. The next time you run
bundle install, without any --without
option, bundler will recall it.
Also, calling Bundler.setup with no
parameters, or calling require
"bundler/setup" will setup all groups
except for the ones you excluded via
--without (since they are obviously not available).
In my case it was installing gems from jenkins env. So i had to set my own bundle_without variable in capistrano.
Gemfile
group :test, :development, :jenkins do
gem 'test-unit', '1.2.3'
gem 'rspec-rails'
end
deploy.rb
set :bundle_without, [:development, :test, :jenkins]
You haven't defined a production group =)