Started learning ruby on rails today, after spending the half day fixing the other errors, I am stuck at the following: When I enter the following command in the terminal: " bundle exec rake db:migrate" or "rails server" it gives me the following error:
Could not find rake-0.9.2 in any of the sources
Run bundle install to install missing gems.
I ran bundle install rake (Both with version number and without) and it says it has been installed to ./rake. When I run the command it gives me the same error again. No Idea how to fix this, so any help is wholeheartedly appreciated. I am using ruby 1.9.2 and rails 3.0.9 in the directory the App is located in with RVM. Thanks in advance for any help.
EDIT:
* LOCAL GEMS *
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using bundler (1.0.15)
Using rdoc (3.8)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using sqlite3-ruby (1.2.5)
EDIT2: This has been fixed: Try using rvm and go back to ruby 1.8.7 instead of 1.9.2. This fixed it for me. Don't forget to install rails again (sudo gem install rails while already on 1.8.7) if you have only installed rails for 1.9.2.]
First, you should unlock the Gemfile
[root#localhost ~]#cd yourapplication [root#localhost
yourapplication]#bundle unlock
Then, edit your Gemfile, add gem rake
[root#localhost yourapplication]#vi Gemfile
+ gem 'rake', '0.9.2'
Then, update bundle
[root#localhost yourapplication]#bundle update
I guess you tried already gem install rake but it should come with rails anyway.
Well, what fl00r said in comments above, or show us the output of gem list --local
Related
i have an old rails project here running rails 2.3.8 and ruby 1.8.7 with rvm.
when i'm running rake -T or another rake task it will fail with
I18n::UnknownFileType: can not load translations from /home/project/trunk/vendor/rails/activesupport/lib/active_support/locale/en.yml, the file type yml is not known
running some YAML in the console, will work.
i found some solutions for rails 3 and ruby 1.9.3 (Rails 3: 'The file type yml is not known' when trying to access basic _form.html.erb) and rails 2.3 with ruby 2 (Rails legacy app and Ruby 2 error: can not load translations from the file type yml is not known) but didnt help.
my Gems used in this project:
actionmailer (2.3.18)
actionpack (2.3.18)
activerecord (2.3.18)
activeresource (2.3.18)
activesupport (2.3.18)
afm (0.2.2)
Ascii85 (1.0.2)
bundler-unload (1.0.2)
color (1.8)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
hashery (2.1.1)
iconv (1.0.4)
little-plugger (1.1.4)
logging (2.0.0, 1.8.2)
multi_json (1.11.2)
mysql (2.9.1)
pdf-core (0.6.0)
pdf-reader (1.3.3)
pdf-writer (1.1.8)
prawn (2.0.2, 0.12.0)
rack (1.1.6)
rails (2.3.18)
rake (10.4.2, 10.1.1)
ruby-rc4 (0.1.5)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
transaction-simple (1.4.0.2)
ttfunk (1.4.0, 1.0.3)
script/console and script/server running fine.
i have to use ruby 1.8.7 and cannot update. upgrade to rails 3 is'nt possible in month's :)
do you have some idea's to get the rake tasks running?
best
robert
i found the solution:
there was several problems:
rake (10.4.2, 10.1.1) now just using rake 10.1.1
logging (2.0.0, 1.8.2) now just using logging 1.8.2
(after testing) had to replace rdoctask with task in Rakefile
now rake -T works fine
When I run rake db:migrate in my console:
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. C
onsider using bundle exec.
(See full trace by running task with --trace)
C:\Rails\myapp>bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.4)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.30)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using addressable (2.2.6)
Using bundler (1.0.18)
Using multipart-post (1.1.4)
Using faraday (0.7.6)
Using friendly_id (4.0.0)
Using hashie (1.2.0)
Using json (1.6.1)
Using multi_json (1.0.4)
Using mysql (2.8.1)
Using oauth2 (0.5.2)
Using omniauth (1.0.2)
Using omniauth-oauth2 (1.0.0)
Using omniauth-facebook (1.2.0)
Using rdoc (3.10)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rest-client (1.6.7)
Using sequel (3.20.0)
Using simple_form (1.5.2)
Using sinatra (1.0)
Using sqlite3 (1.3.4)
Using sqlite3-ruby (1.3.3)
Using taps (0.3.23)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. C
onsider using bundle exec.
(See full trace by running task with --trace)
This is probably because you have a newer Rake version on your system. You can do as the error says: bundle exec rake db:migrate which runs rake in your application context (rake 0.9.2), or just delete your Gemfile.lock and bundle again.
The same happened to me, bundle exec of course worked in the Terminal, but RubyMine would not listen. It turned out that the global gemset used the newer rake-version than the my 'local' gem set, I ended up uninstalling rake from the global gemset to make RubyMine happy again (after a restart that is).
I'm really having a hard time solving this since I don't see any possible solutions that is already written on the net, So I decided to ask a question here at StackOverflow.
Firstly, I have created a new Rails app called "MicroTwitter":
rails new MicroTwitter -T
Here the -T option to the rails command tells Rails not to generate a test directory
associated with the default Test::Unit framework.
After that, I added a few lines on the Gemfile:
group :development do
gem 'rspec-rails'
end
group :test do
gem 'rspec'
gem 'webrat'
end
And so I did a bundle install
But after minutes of waiting, It was stuck up.
C:\Users\MDF\Desktop\apps\rails apps\MicroTwitter>bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.5)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.5)
Using erubis (2.6.6)
Using rack (1.2.2)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.26)
Using actionpack (3.0.5)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.5)
Using arel (2.0.9)
Using activerecord (3.0.5)
Using activeresource (3.0.5)
Using bundler (1.0.11)
Using diff-lcs (1.1.2)
Using nokogiri (1.4.4.1)
Using thor (0.14.6)
Using railties (3.0.5)
Using rails (3.0.5)
Using rspec-core (2.5.1)
Using rspec-expectations (2.5.0)
Using rspec-mocks (2.5.0)
Using rspec (2.5.0)
Using rspec-rails (2.5.0)
Using sqlite3 (1.3.3)
It stuck up just to sqlite3. To those who knew how to solve this problem, Your help is highly appreciated. Thanks!
Ok, I found out the problem.
I for got to install the "webrat" gem.
After I installed webrat:
gem install webrat
and did a bundle install again, It works like magic!
I guess I have to be more careful next time. Thank you for all the answers and comments! :)
There's this snazzy captcha that asks questions rather than displaying pictures. You can read about it at textcaptcha.com. Anyway. I want to use that with Ruby on Rails. A developer by the name of Matt Hutchinson wrote a Gem for easily connecting to the API. He has a set of instructions next to his source files on github. Anyway, It looks pretty simple but in trying to implement it I get this error every time:
undefined method `acts_as_textcaptcha' for #<Class:0x104098508>
Rails.root: /Users/cory/Documents/Learning/RoR/dpt
Application Trace | Framework Trace | Full Trace
app/models/citation.rb:20
app/controllers/citations_controller.rb:29:in `new'
The root of my question has a bit less to do with this specific gem, and a little more with how gems work. I've installed the gem, and then bundled it inside of my rails app, it should be accessible (as I understand it). I see references to the gem in the gemfile.rb and the gemfile.lock, but again and again it tells me I'm using and undefined method.
The gem should be defining the method for me, should it not? Or is there something that I manually have to do?
Just let me know if there is any other info that would be helpful, thanks!
Well, jeez. It's working now. It could be that I restarted the server, but I'm not positive. What I did was installed RubyMine to see if I could use it's debugger, in doing so it required that I run the bundle install (it chose some different versions of some dependancies) through there, and also stop my other webrick server, to run the one through the RubyMine console. I did so, it gave me errors, when when I went back to my other installer it worked!?
Anyway, I've got my question resolved, but in the event that anyone looks this up, these are my current gems:
$ bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.0)
Using builder (2.1.2)
Using i18n (0.4.2)
Using activemodel (3.0.0)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.0)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.0)
Using arel (1.0.1)
Using activerecord (3.0.0)
Using activeresource (3.0.0)
Using bcrypt-ruby (2.1.4)
Using acts_as_textcaptcha (2.2.0)
Using bundler (1.0.10)
Using thor (0.14.6)
Using railties (3.0.0)
Using rails (3.0.0)
Using sqlite3-ruby (1.2.5)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Thanks all!
But if you are trying this, do try restarting the server first as suggested, I wish I knew if that would have worked :D
I'm following the Getting Started with Rails guide, but I ran into a problem:
bash-4.1$ bundle install
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.3)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.3)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.7)
Using tzinfo (0.3.24)
Using actionpack (3.0.3)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.14)
Using actionmailer (3.0.3)
Using arel (2.0.7)
Using activerecord (3.0.3)
Using activeresource (3.0.3)
Using bundler (1.0.7)
Using thor (0.14.6)
Using railties (3.0.3)
Using rails (3.0.3)
Using sqlite3-ruby (1.3.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
bash-4.1$ rake db:create
(in /Users/user/Documents/blog)
Could not find builder-2.1.2 in any of the sources
Try running `bundle install`.
bash-4.1$ bundle show builder
/Users/user/.gem/ruby/1.8/gems/builder-2.1.2
I also tried installing Builder as a RubyGem, but that didn't change a thing.
Try running it through bundle exec to make sure all of the gems specified in your Gemfile are available at their correct versions: bundle exec rake db:create
You can verify the installed gem is visible to bundle like this:
bundle show builder
/usr/lib/ruby/gems/1.8/gems/builder-2.1.2
I have the same problem though, bundle exec rake still fails to see the installed gem.
My version of rake (installed at /usr/bin/rake) was pointing at an old version of Ruby 1.8.
Modify the first line of rake to point at the correct version of Ruby. You can also clear out the bundle cache under the 'vendor' directory or move bundle to another local directory:
bundle install --path gems
On the command line, locate your default 'ruby' and 'rake' commands and check the version of Ruby:
which ruby
which rake
ruby -v
In /usr/bin/rake (line #1):
#!/opt/local/bin/ruby