So I am trying to do bundle install . But it is throwing the below errors. What is the problem here?
bundle exec rake db:create:all
DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:66)
DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:67)
rake aborted!
Cannot load `Rails.application.database_configuration`:
Could not load database configuration. No such file -
/home/.gem/ruby/2.1.3/gems/railties-4.1.5/lib/rails/application/configuration.rb:105:in `database_configuration'
/home/.gem/ruby/2.1.3/gems/activerecord-4.1.5/lib/active_record/railtie.rb:43:in `block (3 levels) in <class:Railtie>'
Could not load database configuration. No such file -
/home/.gem/ruby/2.1.3/gems/railties-4.1.5/lib/rails/application/configuration.rb:105:in `database_configuration'
/home/.gem/ruby/2.1.3/gems/activerecord-4.1.5/lib/active_record/railtie.rb:43:in `block (3 levels) in <class:Railtie>'
Tasks: TOP => db:create:all => db:load_config
(See full trace by running task with --trace)
Earlier I had tried the below:
rake db:create:all
rake aborted!
Gem::LoadError: You have already activated rake 10.4.2, but your Gemfile requires rake 10.3.2. Prepending `bundle exec` to your command may solve this.
/home/.gem/ruby/2.1.3/gems/bundler-1.7.12/lib/bundler/runtime.rb:34:in `block in setup'
/home/.gem/ruby/2.1.3/gems/bundler-1.7.12/lib/bundler/runtime.rb:19:in `setup'
/home/.gem/ruby/2.1.3/gems/bundler-1.7.12/lib/bundler.rb:122:in `setup'
/home/.gem/ruby/2.1.3/gems/bundler-1.7.12/lib/bundler/setup.rb:7:in `<top (required)>'
/home/project/config/boot.rb:4:in `<top (required)>'
/home/project/config/application.rb:1:in `<top (required)>'
/home/project/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/project/config/boot.rb:4:in `<top (required)>'
/home/project/config/application.rb:1:in `<top (required)>'
/home/project/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
$ bundle exec rake db:create:all
DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:66)
DEPRECATION WARNING: String based terminators are deprecated, please use a lambda. (called from included at /home/.gem/ruby/2.1.3/bundler/gems/authlogic-09163c7d2a9b/lib/authlogic/session/callbacks.rb:67)
rake aborted!
Cannot load `Rails.application.database_configuration`:
Could not load database configuration. No such file -
/home/.gem/ruby/2.1.3/gems/railties-4.1.5/lib/rails/application/configuration.rb:105:in `database_configuration'
/home/.gem/ruby/2.1.3/gems/activerecord-4.1.5/lib/active_record/railtie.rb:43:in `block (3 levels) in <class:Railtie>'
Could not load database configuration. No such file -
/home/.gem/ruby/2.1.3/gems/railties-4.1.5/lib/rails/application/configuration.rb:105:in `database_configuration'
/home/.gem/ruby/2.1.3/gems/activerecord-4.1.5/lib/active_record/railtie.rb:43:in `block (3 levels) in <class:Railtie>'
Tasks: TOP => db:create:all => db:load_config
(See full trace by running task with --trace)
You are trying to run "rake db:create:all" which would create your database but as error states - it seems you don't have your config/database.yml file. It's a configuration file that tells rails how to connect to your database. You can read more about it here.
If you really want to run bundle install, just use "bundle install" command instead. This will install all gems listed in your Gemfile.
If you will get problems with rake version conflicts, check out this stack overflow question.
It seems you have no config/database.yml file in your project's directory.
Why I think so? Follow me ...
Could not load database configuration. No such file -
/home/.gem/ruby/2.1.3/gems/railties-4.1.5/lib/rails/application/configuration.rb:105:in `database_configuration'
Ok, let's take a look at this code where we have error:
yaml = Pathname.new(paths["config/database"].existent.first || "")
config = if yaml.exist?
require "yaml"
require "erb"
YAML.load(ERB.new(yaml.read).result) || {}
elsif ENV['DATABASE_URL']
# Value from ENV['DATABASE_URL'] is set to default database connection
# by Active Record.
{}
else
raise "Could not load database configuration. No such file - #{yaml}"
end
As you can see - if no such file or ENV variable then rails throws error.
Related
Please help.
I wanted to set up in Redmine 4.1.1 an email read.
This is my code that I am executing in CLI:
bundle exec rake -f Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=user#domain.com password=PASSWORD ssl=1 project=mars-test-do-not-delete folder=main move_on_success=completed move_on_failure=failed no_permission_check=1 unknown_user=accept no_account_notice=1 --trace
But I am getting this output when I execute the code:
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
NameError: uninitialized constant Redmine::IMAP
/home/seven/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/seven/redmine/app/models/mailer.rb:630:in `with_synched_deliveries'
/home/seven/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
Tasks: TOP => redmine:email:receive_imap
This is only half of the output.
Any ideas? Suggestions? Anything :)
The SMTP works without any problems. I am using an Exchange MS server for email.
Thank you.
As an update:
I set up a new server ubuntu 20.04 LTS
Installed redmine 4.0.6
Ruby 2.5.0
rake 13.0.1
Now when I run:
rake -f Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=EMAIL_USER password=PASSWORD ssl=true project=mars-test-do-not-delete folder=main move_on_success=processed move_on_failure=failed no_permission_check=1 unknown_user=accept 1 > /dev/null
I get this:
Your Gemfile lists the gem redmine_crm (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
rake aborted!
NameError: uninitialized constant Redmine::IMAP
/home/seven/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/seven/redmine/app/models/mailer.rb:612:in `with_synched_deliveries'
/home/seven/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/seven/.rvm/gems/ruby-2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/home/seven/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
/home/seven/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => redmine:email:receive_imap
(See full trace by running task with --trace)
I didi check the redmine_crm, to mu surprise in the Gemfile I have only one reference to it, so I do not fully understand why I get this error to;/
I found the problem.
In file:
/ROOT_PATH_TO_REDMINE/lib/tasks/email.rake
I needed to add one line on the top of the file:
require 'redmine/imap.rb'
That solved the problem.
I have been following a video tutorial and the database is created, but when trying to follow the step by going to directory and entering rake: dbmigrate
I get an error.
Ians-MacBook-Pro:music_library iansherwood$ rake db migrate
rake aborted!
dlopen(/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.bundle
/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `require'
/Users/iansherwood/Sites/music_library/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:66:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler/runtime.rb:55:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p392#global/gems/bundler-1.2.4/lib/bundler.rb:128:in `require'
/Users/iansherwood/Sites/music_library/config/application.rb:7:in `<top (required)>'
/Users/iansherwood/Sites/music_library/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
Have you tried bundle exec rake db:migrate?
Another possibility is that you don't have my MySQL running.
The easiest way to check for that would be:
ps aux | grep mysql
If it isn't running and you installed MySQL through
homebrew (common video guide way to install it) then you can run mysql.server start.
The syntax should be: rake db:migrate, and not rake: dbmigrate or rake db migrate.
It looks like your colon use might be inconsistent. Remember to use:
rake db:migrate
http://guides.rubyonrails.org/command_line.html
Did you include "gem 'mysql2'" in your Gemfile?
I tried running rake db:reset in my rails application after bundle install. The following message is displayed
rake aborted!
cannot load such file -- indirizzo
/home/xyz/Desktop/Signup4/app/models/concerns/address_validation.rb:2:in `<module:AddressValidation>'
/home/xyz/Desktop/Signup4/app/models/concerns/address_validation.rb:1:in `<top (required)>'
/home/xyz/Desktop/Signup4/app/models/location.rb:2:in `<class:Location>'
/home/xyz/Desktop/Signup4/app/models/location.rb:1:in `<top (required)>'
/home/xyz/Desktop/Signup4/db/seeds.rb:11:in `<top (required)>'
Tasks: TOP => db:setup => db:seed
(See full trace by running task with --trace)
bundle show Indirizzo displays
/usr/local/lib/ruby/gems/2.0.0/gems/Indirizzo-0.1.7
It seems to me the problem is in correct require.
According to readme https://github.com/daveworth/Indirizzo#usage it should be
require 'Indirizzo'
but the fact that it does not work (the same error).
It think it should be the same as in the internal lib https://github.com/daveworth/Indirizzo/blob/master/lib/indirizzo.rb
require 'indirizzo/address'
after this I manage to complete this example Indirizzo::Address.new("some address")
I was able to precompile assets an hour ago, but now the rake task is aborting. I also check it on another app, and it's aborting there too. I had interrupted a push to Heroku rather abruptly, and haven't been able to precompile since then.
bundle exec rake assets:precompile
rake aborted!
undefined method `prerequisites' for nil:NilClass
/Users/mm/Sites/quoraquora/Rakefile:7:in `<top (required)>'
(See full trace by running task with --trace)
Line 7 of the rake file is this code Enki::Application.load_tasks
require File.expand_path('../config/application', __FILE__)
Enki::Application.load_tasks
I also did a bundle update, but it didn't change anything. Prior to trying to run the rake task, I abruptly stopped a push to Heroku because I had forgot to compile the assets. Not sure if that could have caused anything. Interestingly, the application still runs on localhost.
I tried to run bundle exec rake assets:precompile on another app, and I also got an error, albeit a different one that says it can't locate 'uglifier' even though that gem is installed.
bundle exec rake assets:precompile
/Users/mm/.rbenv/versions/1.9.3-p327/bin/ruby /Users/mm/.rbenv/versions/1.9.3-p327/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
cannot load such file -- uglifier
(in /Users/mm/Sites/railshangman/app/assets/javascripts/admin.js)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/mm/.rbenv/versions...]
Tasks: TOP => assets:precompile
This is the full trace from the first abort. Can anyone explain? The problem seems to be beyond the scope of one specific app, because bundle exec rake assets:precompile was working fine on every app one hour ago.
Macintosh-3:coffeelover mm$ bundle exec rake assets:precompile --trace
rake aborted!
undefined method `prerequisites' for nil:NilClass
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rspec-rails-2.0.1/lib/rspec/rails/tasks/rspec.rake:3:in `<top (required)>'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rspec-rails-2.0.1/lib/rspec-rails.rb:10:in `block in <class:Railtie>'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie.rb:184:in `instance_exec'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie.rb:184:in `block in load_tasks'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie.rb:184:in `each'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie.rb:184:in `load_tasks'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:423:in `block in load_tasks'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `each'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application/railties.rb:8:in `all'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/engine.rb:423:in `load_tasks'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/application.rb:145:in `load_tasks'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/mm/Sites/coffeelover/Rakefile:7:in `<top (required)>'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:583:in `raw_load_rakefile'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:89:in `block in load_rakefile'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:88:in `load_rakefile'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:72:in `block in run'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/Users/mm/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/Users/mm/.rbenv/versions/1.9.3-p327/bin/rake:23:in `load'
/Users/mm/.rbenv/versions/1.9.3-p327/bin/rake:23:in `<main>'
Try updating your version of rake and rspec-rails
bundle update rspec-rails
bundle update rake
I had to update my version of rspec-rails to 2.6.0 (from 2.0). Strangely, this did not happen automatically if I deleted the gemfile.lock and did bundle update. I had to manually set the version in the Gemfile.
So I've wanted to install RVM for a while on OSX. I finally got it working after figuring out I had to download the latest XCode. I installed ruby 1.9.2 and used these commands to create a new gemset in rvm:
rvm gemset create rails235
rvm 1.9.2#rails235
gem install rails -v 2.3.5
Then I went into one of my old apps that used rails 2.3.5 and tried to run some rakes and any rake I run I seem to get this error:
rake aborted!
no such file to load -- initializer
Also, semi related, right now I'm trying to get rdoc setup. I've never used before and I'm typing in "rake doc::app" and I'm getting that same error.
The full rake with --trace is this:
$ rake doc::app
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'doc::app'
(See full trace by running task with --trace)
brenton-wejrowskis-macbook-pro-2:bizzark wejrowski$ rake doc::app --trace
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'doc::app'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/task_manager.rb:49:in `[]'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:111:in `invoke_task'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `load'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `<main>'
No idea what to do next!
Your rake doc::app error is most probably due to the fact that rake tasks only use a single colon (":") to separate namespaces and task names. Try running rake doc:app instead.