I'm totaly noob in Ruby, and I can't execute the command rake db:load. Sorry for stupid question, but I need help.
The same error is thrown on rake db:seed
root#root:/var/www/dir# rake db:load --trace
rake aborted!
Don't know how to build task 'db:load'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/task_manager.rb:49:in `[]'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:142:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:101:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:73:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-10.0.4/bin/rake:33
/usr/bin/rake:23:in `load'
/usr/bin/rake:23
There's two issues with this project. First of all it lacks a Javascript runtime. You can solve this by adding
gem 'execjs'
gem 'therubyracer'
to the GemFile and rerunning
bundle install
The second problem is that there is no db:load task specified. Looking at the code you want to use
bundle exec rake db:schema:load
That should work.
Related
My environment:
Ruby 2.4.1
Rails 5.1.4
I am trying to use the attach gem, written by the person who also wrote this article https://atech.blog/atech/file-attachments-in-rails-tutorial.
When I run the bundle install it installs attach gem, version 1.0.2
Then when I try to run the rake command I get an error saying it does not know how to build the task.
rake attach:install:migrations --trace
rake aborted!
Don't know how to build task 'attach:install:migrations' (see --tasks)
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/task_manager.rb:59:in `[]'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:159:in `invoke_task'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/usr/local/rvm/gems/ruby-2.4.1/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.4.1/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.4.1/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
Any ideas on what the error is? I am wondering if I am missing a required gem to make it work. The link to the attach documentation is https://github.com/adamcooke/attach
There are no rake tasks defined in this repo.
After you run bundle install, you can get a list of rake tasks by running rake -P (rake -T shows tasks with descriptions). You'll see that attach:install:migrations is not there.
Why not try using paperclip?
I have a rake task that loads data into tables of my database. I made changes recently to my schema, and migrating them to heroku appears to have worked fine. However, when I run my rake task, I get the following error message:
Don't know how to build task 'import_foursquare_response:create_records'
and a less than helpful stack trace:
heroku run rake import_foursquare_response:create_records --trace
Your version of git is 2.2.0. Which has serious security vulnerabilities.
More information here: https://blog.heroku.com/archives/2014/12/23/update_your_git_clients_on_windows_and_os_x
Running `rake import_foursquare_response:create_records --trace` attached to terminal... up, run.5353
rake aborted!
Don't know how to build task 'import_foursquare_response:create_records'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/task_manager.rb:62:in `[]'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:149:in `invoke_task'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.3.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>'
Most of the questions I've seen have pointed to syntax errors in the way people had written the actual rake task, but I can't see any problems there.
require 'four_square'
namespace :import_foursquare_response do
include FourSquare
desc "Load database with results of API calls"
task :create_records => :environment do
puts "Loading database..."
Any help is much appreciated. No data makes my app useless.
I am guessing it is just because heroku does not do any disk writing with rake tasks, please see below:
Src: https://devcenter.heroku.com/articles/rake
I'm trying to bundle exec rake db:create:all
I found that I have two versions of the rake gem:
rake (10.1.0, 0.9.6)
Author: Jim Weirich
Homepage: http://rake.rubyforge.org
License: MIT
Installed at (10.1.0): /Users/david/.rvm/gems/ruby-2.0.0-p247#global
(0.9.6, default): /Users/david/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0
I think there may be an issue with the two different locations of the gems; 10.1 is at #global, and 0.9.6 is not. I think the solution may lay here because...
The trace first looks at the directories in 0.9.6 and then the last two lines look in 10.1:
dn0a158988:portfolio davidngo$ bundle exec rake db:create:all --trace
rake aborted!
cannot load such file -- /Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/boot
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/application.rb:1:in `require'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/config/application.rb:1:in `<top (required)>'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/Rakefile:5:in `require'
/Users/davidngo/Desktop/Coding/RoR_Practice/portfolio/Rakefile:5:in `<top (required)>'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/rake_module.rb:25:in `load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:604:in `raw_load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:89:in `block in load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:88:in `load_rakefile'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:72:in `block in run'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:160:in `standard_exception_handling'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rake/application.rb:70:in `run'
/Users/davidngo/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.6/bin/rake:37:in `<top (required)>'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247#global/bin/rake:23:in `load'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247#global/bin/rake:23:in `<main>'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/Users/davidngo/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
I specified in my Gemfile `gem 'rake', '0.9.6'
I ran bundle update to update the Gemlock file
Thank you in advance -- any help would be appreciated!
Thought: I'm going to try to uninstall the 10.1 version of rake and see if it'll work.
I don't think it's the multiple versions of rake. The bundle exec bit should do the right thing. Are you missing the /config/boot.rb file referred to at /config/application.rb:1?
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.
I am using adcenter-client gem for using microsoft's adcenter api in my RoR-2.3.8 application.
I am using ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
After installing the gem adcenter-client -v=7.0.3 I tried to execute rake adcenter-client but I got the following error:
rake aborted!
Don't know how to build task 'adcenter-client'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in `[]'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:115:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
Can anyone please give me some suggestion to solve this error?
You only need to run this rake task if you checkout the code directly. When working with the Gem it is not needed.
Got the solution...
Even it is mentioned in GitHub to run rake adcenter-client, but it doesn't require. Code will work properly without this rake task too.