I am trying to learn rails from http://ruby.railstutorial.org/
Exercise 3 explains to install rspec, rspec-rails, and webrat using this gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.6'
gem 'sqlite3', '1.3.3', :require => 'sqlite3'
group :development do
gem "rspec-rails", ">= 2.0.1"
end
group :test do
gem "rspec-rails", ">= 2.0.1"
gem 'rpsec'
gem 'webrat'
end
i have tried to install rspec-rails and webrat and they seem to have installed correctly.
C:\RubyProject\sample_app>gem install rspec-rails -v=2.0.1
**************************************************
Thank you for installing rspec-rails-2.0.1!
This version of rspec-rails only works with versions of rails >= 3.0.0
To configure your app to use rspec-rails, add a declaration to your Gemfile.
If you are using Bundler's grouping feature in your Gemfile, be sure to include
rspec-rails in the :development group as well as the :test group so that you
can access its generators and rake tasks.
group :development, :test do
gem "rspec-rails", ">= 2.0.1"
end
Be sure to run the following command in each of your Rails apps if you're
upgrading:
script/rails generate rspec:install
Even if you've run it before, this ensures that you have the latest updates
to spec/spec_helper.rb and any other support files.
Beta versions of rspec-rails-2 installed files that are no longer being used,
so please remove these files if you have them:
lib/tasks/rspec.rake
config/initializers/rspec_generator.rb
Lastly, be sure to look at Upgrade.markdown to see what might have changed
since the last release.
**************************************************
Successfully installed rspec-rails-2.0.1
1 gem installed
Installing ri documentation for rspec-rails-2.0.1...
Installing RDoc documentation for rspec-rails-2.0.1...
But when i run bundle install
I get the following error message
Could not find gem 'rpec-rails (= 2.0.1)' in any of the gem sources listed in your Gemfile.
So me being a total newbie to RoR has no idea why this is occurring. I have tried following this link
http://railsforum.com/viewtopic.php?id=41464
which seems to be a dead end. I'm hoping that someone here can point me in the right direction. Any help would be appreciated.
If your output is correct:
Could not find gem 'rpec-rails (= 2.0.1)' in any of the gem sources listed in your Gemfile.
Then it looks like you've got a typo in your gem file. You've installed the gem, but it won't bundle with the app since you didn't spell rspec-rails correctly. Check your declarations in the gem file.
It is an annoying word to spell.
I noticed your :test group contains a typo: rpsec instead of rspec.
Related
I'm new to RoR and I keep getting this error when trying to install Amazon gem aws-3:
Could not find gem 'aws-3' in any of the gem sources listed in your Gemfile or available on this machine.
I'm using Rails 5.
The gem per se appears to successfully be installed:
$ gem install aws-s3
Successfully installed aws-s3-0.6.3
Parsing documentation for aws-s3-0.6.3
Done installing documentation for aws-s3 after 1 seconds
1 gem installed
Added it to my Gemfile:
gem 'aws-3', :require => 'aws/s3'
On the top of the Gemfile I have listed:
source 'https://rubygems.org'
You misspelled aws-s3 as aws-3in the Gemfile. It should be
gem 'aws-s3', :require => 'aws/s3'
Note: There's no gem which goes by the name aws-3. That is why you were getting the error.
As told by #Arun Kumar,
you need to add aws-s3 gem in your gemfile.Here is the github
I've changed in my gemfile the rails version from 3.2.12 to 4.2.0
then I got this error:
The bundle currently has rails locked at 3.2.12
so I tried bundle update / and bundle update rails ... but I got this:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
prototype-rails (>= 0) ruby depends on
rails (~> 3.2) ruby
rails (4.2.0)
What do I have to do?
Update Gemfile:
source 'http://rubygems.org'
#gem 'rails', '3.2.12'
gem 'rails', '4.2.0'
gem "airbrake"
#gem "mysql"
gem 'mysql2', '~>0.3.7'
gem 'fastercsv'
gem 'newrelic_rpm', :group => [:production, :staging]
gem "xml-simple", :require => "xmlsimple"
gem "will_paginate", "~> 3.0.0"
gem "json", '1.7.7'
gem "default_value_for"
gem "whenever"
gem 'charlock_holmes'
gem 'prototype-rails'
gem 'rails_autolink'
group :development do
gem 'capistrano'
gem 'capistrano-ext'
end
Just run
bundle update
without telling to update just a specific gem (like rails). This allows bundler to find the lastest possible combination for all gems in the Gemfile.
The prototype-rails gem is not actively supported anymore. You should try to replace it as soon as possible (even if the latest version still works for you).
Furthermore: Multiple configuration settings have changed between Rails 3.2 and 4.2, you will have to change some of your config and core files. You also might want to read the Rails Guide: Upgrading Rails.
I suggest to upgrade your app in smaller steps (3.2 -> 4.0, 4.0 -> 4.1, 4.1 -> 4.2). Make sure that the app works in each step before you continue to the next. Also, watch out for deprecation warnings in the console or the logs.
remove your gemfile.lock
rm Gemfile.lock
then add
rails 4.2.0 in your Gemfile
then
bundle install
I think, the problem is in prototype-rails
https://github.com/rails/prototype-rails
Below Comment of prototype-rails gem
Unfortunately, due to limited manpower and resources, the Rails core team has not been able to confirm if this gem currently works with Rails 4.1 and above. If you have found any problems while upgrading your application, please report them at the issue tracker, or better yet, submit patches by sending a pull request.
Tried to remove first remove prototype-rails then run
bundle update
I went back to a rails project I was working on and the command "rails s" started to fail. The Terminal recommended that I run a bundle install. When I did I received the following message:
Bundler could not find compatible versions for gem "activemodel":
In Gemfile:
protected_attributes (>= 0) ruby depends on
activemodel (< 5.0, >= 4.0.0.beta) ruby
rails (>= 0) ruby depends on
activemodel (3.2.12)
I have updated both ruby and rails. I've re-installed active model and restarted my terminal.
My gems file is very simple:
gem 'rails'
gem 'jquery-rails'
gem 'devise'
gem 'simple_form'
gem 'protected_attributes'
group :production do
gem 'pg'
end
group :development, :test do
gem 'sqlite3'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', '~> 2.2.2.0'
gem 'bootstrap'
end
Remove your Gemfile.lock and run
rm Gemfile.lock
and
bundle install
Remove Gemfile.lock
and then bundle
if not works then specify rails version in gemfile.
have you tried running
gem update activemodel
or
bundle update
Bundler has attempted to install Rails 4 and associated gems, but you have some gems fixed at earlier incompatible versions. Either specify a 3.x.x version of Rails or remove the version requirements on your sass-rails and coffee-rails gems.
(I took your Gemfile into a sample application and attempted to run a bundle install--I didn't get the exact error you're seeing but an error of the same cause. Removing the version requirements on those gems solved the issue. Of course that may not be appropriate for your needs!)
I just made my first setup of RoR, and creating a new application works fine. But when I want to run the rails server I get the following error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/yaml_ext.rb:30:in 'remove_method': method 'to_yaml' not defined in Class (NameError)
I ran the "bundle install" in the app directory and installed all the necessary files (with some problems however, but I excluded the gems with problems in the gemfile) and the last bundle install said that I have successfully installed all the needed packs.
I'm lost and I can't find a similar error on the internet. Can you help me?
EDIT: I forgot to mention that I'm not having a problem with a new application. It's running an existing one (that I didn't build, but works fine for others) that the error is related to. Here's the gemfile for that app:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'mysql'
gem "haml", ">= 3.0.0"
gem "haml-rails"
gem 'simple_form'
gem 'delayed_job'
#gem 'auto_crawlers'
gem 'will_paginate', '~> 3.0.beta'
group :test do
gem 'factory_girl_rails'
gem 'mocha'
end
group :development do
#gem "nifty-generators", "0.4.3", :git => "git://github.com/JonasNielsen/nifty-generators.git"
gem 'fastercsv'
end
gem "mocha", :group => :test
Do you think the error is because I left out the two gems with "#" ? Those were causing problems at first, and I don't think I need them to test some minor changes in the app (some views that I have to modify)
The issue is being described, and supposedly fixed here: https://github.com/collectiveidea/delayed_job/issuesearch?state=open&q=yaml#issue/194
Try this from the command line: irb -rubygems -r delayed_job and then from your bundled directory bundle-exec irb -rubygems -r delayed_job which will show if there is a difference between your system gems and your bundled setup - you might see an error in one or both attempts to run IRB.
If there is an error using bundle-exec but not with your system gems then it's a bundler issue. If not, are you sure the app is designed to function under Ruby 1.9? It looks like to_yaml isn't available at the point DJ is required, which implies it probably needs a require "yaml" somewhere.
Not sure what's going on, but I can't get autotest to work with rails 3. I'm using ruby 1.9.2-head and Rails 3.0.0 and I have all of the relevant gems installed. I'm declaring them in my gemfile like this:
group :development do
gem 'rspec-rails', '2.0.0.beta.18'
gem 'annotate-models', '1.0.4'
gem 'autotest'
gem 'autotest-rails'
gem 'autotest-growl'
gem 'autotest-fsevent'
end
When I try to run the autotest command I'm getting the following error:
enter code hereError loading Autotest style autotest/rails_rspec2 (no such file to load -- autotest/rails_rspec2). Aborting.
I just figured out that I can run "bundle exec autotest" instead of just "autotest" and it works, but I have no idea why this is.
The gem rspec-rails is now at least at beta22, and while it had problems with autotest it should now be fixed. I can run autotest without having to do bundle exec. So you should adapt your gemfile to allow using the latest version.
So write something like
group :development, :test do
gem "rspec-rails", ">= 2.0.0.beta.18"
gem "autotest"
end
The autotest-rails is no longer needed.