no such file to load -- /app/config/application - ruby-on-rails-3

I have a rails app which I've pushed to heroku GIT repo, every thing is fine, until I try to migrate data bases, here is what I get:
sam#ubuntu:~/RubymineProjects/dcaclab$ heroku run rake db:migrate --trace
Running `rake db:migrate --trace` attached to terminal... up, run.1
rake aborted!
no such file to load -- /app/config/application
/app/Rakefile:5:in `require'
/app/Rakefile:5:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `load'
/app/vendor/bundle/ruby/1.9.1/bin/rake:19:in `<main>'
Any idea please ?

I ran into the same issue and figured it out - I'd accidentally added my config folder to my .gitignore, so it wasn't pushed to Heroku.

Related

Ruby On Rails server initiation errors

I have been following the tutorial on how to learn Ruby On Rails basics. I have installed the latest 2.2.3 version and ran "gem install rails". I have successfully created a new project, but I have got an error when tried to run a server with "rails server" command. I received these errors:
C:\Users\Kothas\Desktop\rubyonrails\myproject>rails server
c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.r:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/ib/sqlite3.rb:6:in `rescue in <top (required)>'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:76:in `require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:76:in `block (2 levels) in require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:72:in `each'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:72:in `block in require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:61:in `each'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/
untime.rb:61:in `require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.
b:134:in `require'
from C:/Users/Kothas/Desktop/rubyonrails/myproject/config/application.r
:7:in `<top (required)>'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:78:in `require'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:78:in `block in server'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:75:in `tap'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:75:in `server'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands/commands_tasks.rb:39:in `run_command!'
from c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/railties-4.2.3/lib/rails/co
mands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
How can I fix these problems and start my application?
EDIT
I managed to fix sqlite3 errors, but the new ones showed
"cannot load such file -- nokogirl (LoadError)"
It looks like your application is having difficulty accessing your sqlite installation through the sqlite3 gem - try this answer: cannot load such file -- sqlite3/sqlite3_native (LoadError) on ruby on rails

LoadError: cannot load such file -- test/unit/error

I am trying to install insoshi in Rails 3.2.21 with ruby 1.9.3 every thing gone good but now I am stopped with an error when I try $rake gems:install it gives an error
rake aborted!
LoadError: cannot load such file -- test/unit/error
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/deprecation.rb:22
4:in `<top (required)>'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `block in require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:5
21:in `new_constants_in'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support/dependencies.rb:1
53:in `require'
C:/Sites/insoshi/vendor/rails/activesupport/lib/active_support.rb:37:in `<top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/misc.rake:11:in `<top (required
)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `load'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `block in <top (r
equired)>'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `each'
C:/Sites/insoshi/vendor/rails/railties/lib/tasks/rails.rb:4:in `<top (required)>
'
C:/Sites/insoshi/Rakefile:10:in `<top (required)>'
(See full trace by running task with --trace)
I am totally new with rails. hope for help
Try adding following gem into your gem file
gem 'test-unit'
Hope it will solve your problem.

Error on db:migrate

I am trying to modify a rails app built on an another computer ,I ran bundle install
and all gems got installed.But when I run rake db:migrate ,it throws down a bunch of errors ,I am new to rail and cant understand what those error messages
rake aborted!
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so: undefined symbol: ruby_current_thread - /home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.so
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `require'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/ruby-debug-base19-0.11.25/lib/ruby-debug-base.rb:1:in `<top (required)>'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `require'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:5:in `<top (required)>'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/home/diadara/hw3_rottenpotatoes/config/application.rb:13:in `<top (required)>'
/home/diadara/hw3_rottenpotatoes/Rakefile:5:in `require'
/home/diadara/hw3_rottenpotatoes/Rakefile:5:in `<top (required)>'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/bin/rake:19:in `<main>'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/bin/ruby_noexec_wrapper:14:in `eval'
/home/diadara/.rvm/gems/ruby-1.9.3-p374#saasrails3.1/bin/ruby_noexec_wrapper:14:in `<main>'
it looks like you did not properly install ruby-debug in your project. remove it from the gemfile if it is not needed or have a look at this answer to fix it: Cannot use ruby-debug19 with 1.9.3-p0?

Impossible to use rake in my rails project

Every time I try to use rake in my rails project it throw me the message below. I tried to re-install ruby, rails, rake, re-create the project, launch my rake db:migrate with sudo but nothing seems to work...
I created the object via the scaffold command:
rails generate scaffold User nom:string email:string
After this command execute succesfully, i launch
rake db:migrate
And it return this message:
rake aborted!
GONE
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks/documentation.rake:1:in `require'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:15:in `load'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:15:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:6:in `each'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/tasks.rb:6:in `<top (required)>'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:213:in `require'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:213:in `initialize_tasks'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:139:in `load_tasks'
/var/lib/gems/1.9.1/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
/home/bassochette/Dev/rails/tuto/demo_app/Rakefile:7:in `<top (required)>'
(See full trace by running task with --trace)
ps: I'm new to rails and in the learning phase.

Custom rake tasks are running when I run 'rake db:migrate'. How do I prevent this?

I'm running rails on ubuntu 12.04. When I run the code below I get an error from one of my custom tasks. Problem is I didn't want my custom tasks to run in the first place. Just the db migrations.
rake db:migrate --trace
rake aborted!
cannot load such file -- CSV
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
/var/www/myapp/lib/tasks/import_inventory.rake:1:in `<top (required)>'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `block in load'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:245:in `load'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/engine.rb:425:in `block in load_tasks'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/engine.rb:425:in `each'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/engine.rb:425:in `load_tasks'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/application.rb:145:in `load_tasks'
/home/js/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/myapp/Rakefile:7:in `<top (required)>'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `load'
/home/js/.rvm/gems/ruby-1.9.3-p194#global/bin/rake:19:in `<main>'
/home/js/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
/home/js/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
Rake task being ran:
require 'CSV'
namespace :db do
desc 'Prepare transition database.'
task :import_inventory => :environment do
desc 'Import Assets Table'
file_path = "/Users/js/data/TSI/inventory.csv"
CSV.foreach(file_path, :headers => true) do |row|
asset = Asset.new
asset.asid_tag = row[0]
asset.description = row[1]
asset.qty = row[2]
asset.manufactuer = row[3]
asset.model = row[4]
asset.save
end
end
end
When you run Rake all the task files (lib/tasks/*.rb) are loaded and parsed before rake can determine what tasks are available. This means, whether you call the import task or not, the file import_inventory.rake is being parsed by ruby before the actual task you requested (db:migrate) is run. As a result require 'CSV' is executed, regardless of what task you are really trying to run.
As for a fix, I'm guessing it should be require 'csv' (lowercase) rather than require 'CSV' (uppercase)?