I am getting an error while running rails console:
`require': Please add test-unit gem to your Gemfile: `gem 'test-unit', '~> 3.0'`(cannot load such file -- test/unit/testcase) (LoadError)
If I add this gem to my Gemfile then rails console works fine. But why does it keep asking me to add this gem to my Gemfile?
Rails version 3.2.2
It's rails dependency: https://github.com/drapergem/draper/issues/690
Please read more about that: https://bugs.ruby-lang.org/issues/9711
Related
My rails application cannot start because mysql2 load error.
I have tried many solutions, But none can't fix the problem.
Even the rake command can't be executed.
rake aborted!
LoadError: cannot load such file -- mysql2/mysql2
My gemfile is:
ruby '2.5.1'
gem 'rails', '~> 4.2.4'
gem 'mysql2', '~> 0.5.2'
Bundle installed successfully. Mysql installed correctly. Yet the error occurs on MacOS.
Simply, uninstall and reinstall with the following command:
gem install mysql2
If this is not working, you can try adding the following to your mysql_config:
gem install mysql2 -v 0.4.4 -- --with-mysql-config=/usr/local/Cellar/mysql#5.6/5.6.42/bin/mysql_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
I am new to ruby on rails and am trying to run my first application which connected to MongoDb. How do i know if I have Mongoid gem installed or if I have to install it? and what is the command to know the gem version.
In my rails application Gemfile I have added:
gem 'mongoid', '~> 5.0.0'
but it gives the error:
usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/resolver.rb:366:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'mongoid (~> 5.0.0.1)' in any of the gem sources listed in your Gemfile or available on this machine. (Bundler::GemNotFound)
I think the gem is not present in your local machine. So it's giving you error. Try running command
bundle install
or you can manually install this gem using console by this command
gem install mongoid -v 5.0.0
Hope it helps. Cheers!
i am using ruby 1.8.7 and rails 3.0.12 for my project.
when i run "bundle install", i get the following error.
Gem::InstallError: linecache19 requires Ruby version >= 1.9.2.
An error occurred while installing linecache19 (0.5.12), and Bundler cannot continue.
i don't want to change my ruby version.
You can try using the debugger gem instead of ruby-debug. Check out your gemfile and replace gem "ruby-debug" with gem "debugger". From memory that's how I did it.
Replacing gem 'ruby-debug19' with gem 'ruby-debug' worked for me.
When I add has_secure_password to the model (inherited from ActiveRecord::Base), error stating that "bcrypt-ruby is not part of the bundle" occurs.
Here the log is:
Started GET "/users" for 127.0.0.1 at 2012-02-19 16:37:12 +0900
Gem::LoadError (bcrypt-ruby is not part of the bundle. Add it to Gemfile.):
app/models/user.rb:3:in `<class:User>'
app/models/user.rb:1:in `<top (required)>'
app/controllers/users_controller.rb:1:in `<top (required)>'
I installed bcrypt-ruby by
$ gem install bcrypt-ruby
Building native extensions. This could take a while...
1 gem installed
Installing YARD (yri) index for bcrypt-ruby-3.0.1...
Installing RDoc documentation for bcrypt-ruby-3.0.1...
but was no avail.
I tried
$ bundle exec rails server
but was no help.
If I comment out the line "has_secure_password", this error does not come out.
How can I solve this problem?
I already had gem 'bcrypt-ruby', '~> 3.0.0' in Gemfile, and had already ran the command bundle, and yet I still got that message. The problem was that I forgot to restart the server:
touch tmp/restart.txt
As the message says you need to add bcrypt-ruby to your Gemfile (at the root of the project).
Adding
gem "bcrypt-ruby"
and then running bundle install should do the trick (this would fetch the gem if you hadn't already installed it).
You can specify specific versions to, eg
gem "bcrypt-ruby", "~> 3.0.1"
will get you the latest version that is >= to 3.0.1 but less than 3.1. You might do this if 3.0.1 has a bug fix you depend on and you're happy to get more bug fixes but you don't want major changes. There's loads more info on the bundler website.
In your Gemfile add a line
gem 'bcrypt-ruby'
and then from the command line
bundle install
Something that came up for me that is not addressed here yet. I got this error after going to a new system on which I installed Ruby 2.0.x.
It turns out that even if I was using the new bcrypt 3.1.7 it didn't work for me until I ALSO had bcrypt-ruby 3.0.1 in the gemfile. I resisted that when I should have just taken the error at it's word.
gems:
bcrypt (3.1.7 ruby x86-mingw32)
bcrypt-ruby (3.0.1 x86-mingw32, 3.0.0)
gemfile:
gem 'bcrypt-ruby', '~> 3.0.1'
gem 'bcrypt', '~> 3.1.7'
Before adding both I tried all sorts of single version combinations.
Restart the server and reinstall bundle in correct order, that is:
bundle install, bundle update, bundle install
and then server restart.
If you already put the gem in the gem file and bundle installed and you are still getting an error then restart your server.
Our app had been working. Now I just pushed some new code into staging on Heroku for the 1st time after they moved to bundler 1.0.7. Now our app crashes and I got this error message -
/usr/ruby1.9.1/lib/ruby/gems/1.9.1/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require': no such file to load -- redcloth (MissingSourceFile)
We're on Rails 2.3.8.
Here is part of the Gemfile -
gem 'rails', '2.3.8', :require => nil
gem 'RedCloth', :require => 'redcloth'
Any ideas on how to fix this problem? Thanks.
I'm on Heroku and this is what I have :
gem 'RedCloth', '4.2.3'