I'm trying to clone the Catarse repository: Git catarse
and I get all the way to the end but once I try to run rake db:seed I get the following error message:
rake aborted!
Errno::ENOENT: No such file or directory # dir_initialize - /Users/'USERNAME'/Desktop/my_websites/crowdfund_test/catarse/tmp/cache/
/Users/'USERNAME'/Desktop/my_websites/crowdfund_test/catarse/db/seeds.rb:116:in `<top (required)>'
Tasks: TOP => db:seed
Do you know why??
I was having the same problem. Then I realized I did not have the directory
/yourPath/catarse/tmp/cache/
Once I created it, seeding worked just fine!
Related
I was trying to run the following command but the result was not what i expected
rake db:create
the result:
rake aborted!
LoadError: cannot load such file -- /mnt/c/newapp/config/application
/mnt/c/newapp/rakefile:4:in require_relative' /mnt/c/newapp/rakefile:4:in <top (required)>'
(See full trace by running task with --trace)
i tried reinstalling postgres but that did not solve the problem, I also tried to install all ruby's packages but it did not work at all.
The error is telling you that on line 4 of your rakefile the require_relative "config/application" line is failing, "cannot load such file -- /mnt/c/newapp/config/application", do you somehow not have a config/application.rb file in your project?
I'm trying to clone and setup a rails repo.
when I run bundle exec rake db:migrate I get the following error with no user name:
rake aborted!
ArgumentError: is not a recognized providerronment.rb:5:in `<top (required)>'
It should be a problem with the provider. If I were you, I would try to set up the provider again.
provider: ENV['FOG_PROVIDER']
I'm playing with rails 4. I just created very simple test for my model but when I try to execute "rake test:models" I get following error:
C:\rails\project>rake test:models
DL is deprecated, please use Fiddle
rake aborted!
Errno::EACCES: Permission denied # unlink_internal - /tmp/db/new.sqlite3
C:/rails/project/test/test_helper.rb:3:in `<top (required)>'
C:/rails/project/test/models/admin_test.rb:1:in `<top (required)>'
Tasks: TOP => test:models
(See full trace by running task with --trace)
My test database configuration looks as follows:
test:
adapter: sqlite3
database: /tmp/db/new.sqlite3
pool: 5
timeout: 5000
"/tmp/db" is directory where I have full access on my personal laptop.
Any ideas what could be source of this problem?
One way I was able to get around this error was using
rake db:migrate rails_env=test
This generated the necessary migrations on my test.sqlite3
I believe the default setting for rails_env is "dev" but this may vary. I am still very new to rails but I hope this helps.
I had the same problem with my test.sqlite3 table and what worked for me was making a copy of my development.sqlite3 table and renaming it test.sqlite3. I hope this works for you.
When I run heroku run rake db:migrate, I receive the following error:
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.8507
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/lib/ruby/1.9.1/rake.rb:2367:in `raw_load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `<main>'
Other users have posted identical errors, but in their case they actually didn't have a Rakefile and it worked for them once they created one, or they were in the wrong directory. My app does have a Rakefile, in the correct directory and with all the proper text in it, and I am in my app's root directory.
This is what my Rakefile looks like:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
Rails.application.load_tasks
This is what "heroku run cat Rakefile" does:
$ heroku run cat Rakefile
Running `cat Rakefile` attached to terminal... up, run.9132
cat: Rakefile: No such file or directory
Whenever you are struggling with Heroku you should check your logs:
heroku logs
Scan through for any errors that you can google and/or get hints to what is going wrong.
If you are using git you can quickly search for errors with this:
git grep "whatever you want to search for"
You will then know where to find the file so you might try to verify that the rakefile actually exists with:
git grep rakefile
Sometimes it is easier to just start fresh and reset your database and reload your current schema with:
rake db:reset db:migrate all
This will destroy your db and then create it and then migrate your current schema:
rake db:drop db:create db:migrate
If you want to reset the heroku db
To drop the database, if you are using SHARED_DATABASE_URL:
heroku pg:reset DATABASE
To recreate the database with nothing in it:
heroku run rake db:migrate
To populate the database with your seed data:
heroku run rake db:seed
I have an app that I have been in happily developing for some time, and haven't had any trouble seeding the production database with my seed file until recently, as I have been attempting to get capistrano deployment working, which spawned an upgrade and gem dependency exercise;-first I blamed capistrano but this behavior happens locally.
So if I reset and seed with:
RAILS_ENV=production rake db:reset
and I end up with tables being undefined that the seed file is attempting to load: e.g:
...tables being built:
.
.
.
-- initialize_schema_migrations_table()
-> 0.0037s
-- assume_migrated_upto_version(20140117153600, ["/Users/jaytho/Projects/1.1.1-a1.dev.merge_test/db/migrate"])
-> 0.0020s
BankCards
rake aborted!
uninitialized constant BankCard
/Users/jaytho/Projects/1.1.1-a1.dev.merge_test/db/seeds.rb:7:in block (2 levels) in <top (required)>'
/Users/jaytho/Projects/1.1.1-a1.dev.merge_test/db/seeds.rb:6:inblock in '
/Users/jaytho/Projects/1.1.1-a1.dev.merge_test/db/seeds.rb:4:in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/railties-3.2.16/lib/rails/engine.rb:525:inload'
/usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/railties-3.2.16/lib/rails/engine.rb:525:in load_seed'
/usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:347:inblock (2 levels) in '
/usr/local/rvm/gems/ruby-1.9.3-p448#global/gems/activerecord-3.2.16/lib/active_record/railties/databases.rake:290:in `block (2 levels) in '
Tasks: TOP => db:setup => db:seed
(See full trace by running task with –trace)
of which BankCard is the first table seeds.rb is attempting to populate. Comment out BankCard and it just goes to the next table.
The db:reset command works perfectly with in the other environments:
RAILS_ENV=development rake db:reset
and
RAILS_ENV=test rake db:reset
a downgrade to 3.2.15 did not help. I also attempted many permutations like:
bundle exec rake db:reset RAILS_ENV=production
RAILS_ENV=production bundle exec rake db:drop db:create db:migrate db:seed
and I even wiped all my migrations and tried just from the schema thinking that a mangled migration silently causing an issue:
RAILS_ENV=production bundle exec rake db:schema:load db:seed
without any luck- exact same answer.
I also attempted to extract the seed.rb routines into a separate rake task- same result.
The brain twister for me is that if I call the seeds.rb from the console:
'echo load “db/seeds.rb”' | RAILS_ENV=production rails c
she loads without any issues. It works from the console.
I attempted to get into databases.rake and try and recreate the environment there to duplicate the environment into my own rakefile; however, since calls into databases.rake exhibit the same problem, I am pretty much stuck between a rock and a hard place.
What can I be doing wrong to pollute only the production environment? How can I debug this?
Thanks in advance. Beer is on me if you ever are in Dallas.
After some insomnia and some more varied google searches I stumbled on this website: http://community.activestate.com/node/9065 and
Rails 3.2.11 asset precompile fails if threadsafe! enabled where they give clues that threadsafe is important.
Sure enough; if I comment out the threadsafe line in config/environments/production.rb:
# Enable threaded mode
# config.threadsafe!
My rake db:seed tasks work in production.
the solutions in those articles, for some reason didn't work. I ended up doing this to fix it in config/environments/production.rb
# Enable threaded mode
config.threadsafe! unless $rails_rake_task
I hope this helps somebody else out who is upgrading.