I'm following Rails Tutorials by Michael Hartl (chapter 3). However, when I edit the Gemfile like he did and then run rake test, rails suggested me to put this line : config.web_console.development_only = false
in the application config file. I did that and run bundle exec rake test again, here's the error message:
/home/ys/workspace/sample_app/db/schema.rb doesn't exist yet. Run `rake db:migrate` to create it, then try again. If you do not intend to use a database, you should instead alter /home/ys/workspace/sample_app/config/application.rb to limit the frameworks that will be loaded.
/home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- guard (LoadError)
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-minitest-2.4.4/lib/minitest/guard_minitest_plugin.rb:4:in `<top (required)>'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:91:in `block in load_plugins'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:85:in `each'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:85:in `load_plugins'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:114:in `run'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:56:in `block in autorun'
I then proceeded to rake db:migrate, then run rake test again:
Running via Spring preloader in process 15638
/home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- guard (LoadError)
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/guard-minitest-2.4.4/lib/minitest/guard_minitest_plugin.rb:4:in `<top (required)>'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:91:in `block in load_plugins'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:85:in `each'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:85:in `load_plugins'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:114:in `run'
from /home/ys/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/minitest-5.8.4/lib/minitest.rb:56:in `block in autorun'
All I can guess is that there is something wrong with Ruby because I upgraded from 2.3.0 to 2.3.1 the other day as rails console complained about buggy, old version when I run bundle install.
So, How to fix this?
https://github.com/guard/guard-minitest
Add the guard gem to your gem file.
gem 'guard'
Looks like this might work:
1) Just remove guard-spring from your Gemfile and Guardfile.
2) Then upgrade guard-rspec (run bundle update guard-rspec)
3) Setup
guard-rspec to use spring (see this:
https://github.com/guard/guard-rspec#options)
From: https://github.com/guard/guard/issues/734
Related
I am newbie with Rails and here is my problem. I setup a new rails program named freelancer02 and in the file database.yml I saw the database : freelancer02_development and database : freelancer02_test
So I think, I could run this command to setup a new database
rails db:setup
But it gave me this error
rails aborted!
LoadError: incompatible library version - /Users/anhbui/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg_ext.bundle
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:49:in `block in <module:PG>'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:37:in `block in <module:PG>'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:42:in `<module:PG>'
/Users/xxx/.gem/ruby/3.1.2/gems/pg-1.4.5/lib/pg.rb:6:in `<main>'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:55:in `each'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:55:in `block in require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:44:in `each'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler/runtime.rb:44:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bundler-2.3.26/lib/bundler.rb:186:in `require'
/Users/xxx/Desktop/Rails/freelancer02/config/application.rb:7:in `<main>'
/Users/xxx/Desktop/Rails/freelancer02/Rakefile:4:in `require_relative'
/Users/xxx/Desktop/Rails/freelancer02/Rakefile:4:in `<main>'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/command.rb:51:in `invoke'
/Users/xxx/.gem/ruby/3.1.2/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/Users/xxx/.gem/ruby/3.1.2/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
bin/rails:4:in `<main>'
(See full trace by running task with --trace)
I also ran this command
rake db:reset RAILS_ENV=test
but it still gave me the error above
When I check by ruby -v and rails -v, my version is ruby 3.1.2 and rails 7.0.4
Could you please give me some advices ? Thank you very much for your time.
in my app , I am using spree gem. Now for product importing ,i used spree_import_products gem.
first i add "gem 'import_products', :git => 'git://github.com/joshmcarthur/spree-import-products.git'
then bundle install" in gem file.then run bundle install, it successfully installed. then run "rake import_products:install".but it shows error like this....
rake aborted!
NameError: uninitialized constant Spree::ThemeSupport
/home/ec2-user/.rvm/gems/ruby-2.2.1/bundler/gems/spree-import-products-2bcca17f140f/lib/import_products_hooks.rb:1:in `<top (required)>'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/home/ec2-user/.rvm/gems/ruby-2.2.1/bundler/gems/spree-import-products-2bcca17f140f/lib/import_products.rb:2:in `<top (required)>'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `require'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `each'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in `block in require'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `each'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in `require'
/home/ec2-user/.rvm/gems/ruby-2.2.1/gems/bundler-1.10.6/lib/bundler.rb:134:in `require'
how to resolve this...
You can check here that this extension requires a very old version of Spree and Ruby. It does not have tests. The problem is the extension itself. Look for another extension or implementing yourself.
I keep getting these errors on terminal whenever i run the following code.
rake test or bundle exec rake test
/usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- guard (LoadError)
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/guard-minitest-2.4.4/lib/minitest/guard_minitest_plugin.rb:4:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
from /usr/local/lib/ruby/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:91:in `block in load_plugins'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:85:in `each'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:85:in `load_plugins'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:114:in `run'
from /usr/local/lib/ruby/gems/2.2.0/gems/minitest-5.5.1/lib/minitest.rb:56:in `block in autorun'
Looks like guard is not installed/included in Gemfile. Include it in Gemfile if it is not already there. And run bundle install.
See http://railscasts.com/episodes/264-guard for how to use guard. https://github.com/guard/guard is also a good resource.
I loaded new rails onto my system and now when i runt the test i am getting the below exception. Please advise
~/railsprojects/my_blog (master) ∴ rake test
MiniTest::Unit::TestCase is now Minitest::Test. From /Users/pranavaswaroop/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/test/unit/testcase.rb:8:in `<module:Unit>'
rake aborted!
MiniTest v5.3.0 is out of date.
`gem install minitest` and add `gem 'minitest' to you test helper.
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/turn-0.9.6/lib/turn/minitest.rb:22:in `<top (required)>'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/turn-0.9.6/lib/turn.rb:13:in `require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/turn-0.9.6/lib/turn.rb:13:in `<top (required)>'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
/Users/pranavaswaroop/.rvm/gems/ruby-2.1.1/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
/Users/pranavaswaroop/railsprojects/my_blog/config/application.rb:7:in `<top (required)>'
/Users/pranavaswaroop/railsprojects/my_blog/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
~/railsprojects/my_blog (master) ∴
I were using turn gem, problem solved by removing it.
I just upgraded from ruby 1.9.3-p194 to 1.9.3-p286 via the rvm upgrade command and the gemset. Now when I run rake rails upgrade on my rails app it gives me the following trace:
nosh#nosh-VirtualBox:~/Projects/icon$ rake rails update --trace
rake aborted!
cannot load such file -- ruby_debug.so
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/ruby-debug-base19-0.11.26/lib/ruby-debug-base.rb:1:in `require'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/ruby-debug-base19-0.11.26/lib/ruby-debug-base.rb:1:in `<top (required)>'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `require'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `block in require'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
/home/nosh/Projects/icon/config/application.rb:7:in `<top (required)>'
/home/nosh/Projects/icon/Rakefile:5:in `require'
/home/nosh/Projects/icon/Rakefile:5:in `<top (required)>'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/bin/rake:19:in `load'
/home/nosh/.rvm/gems/ruby-1.9.3-p286#global/bin/rake:19:in `<main>'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `eval'
/home/nosh/.rvm/gems/ruby-1.9.3-p286/bin/ruby_noexec_wrapper:14:in `<main>'
Any suggestions are appreciated. If its the ruby version conflict with ruby debug 19 gem. Then how should I downgrade back to 1.9.3-p194.
I guess I just had to try it; but the same rvm command that allows the upgrade also allows downgrade. So the following command allowed me to downgrade to the previous version:
rvm upgrade 1.9.3-p286 1.9.3-p194
It migrated the gems as well.
By the way I also found out after the downgrade that the rake rails update command I used had incorrect syntax.
So this is incorrect:
rake rails update --trace (incorrect)
This is correct:
rake rails:update --trace (correct)
I did not get the error after the upgrade again, that means I was probably using the wrong syntax.