Error with migrating database in heroku - ruby-on-rails

I'm following Michael Hartl's tutorial on learning web development with rails. When it comes to migrating the database the command:
heroku run rake db:migrate
gives the following error
Running `rake db:migrate` attached to terminal... up, run.2675
/usr/bin/env: ruby1.9.1: No such file or directory
I'm using Ruby 1.9.3 and I have declared that in the Gemfile. I don't really understand what could be causing this error and any help at all would be greatly appreciated.

use this
/usr/bin/env ruby
instead of
/usr/bin/env ruby.exe
on following files of your app.
bin/bundle
bin/rails
bin/rake
and the exec
heroku run rake db:migrate

Related

Error when migrating Rails App in development environment

I have an application in rails 4.2.7.1, when I run the db:migrate in test in works perfectly
➜ bundle exec rake db:drop RAILS_ENV=test
➜ bundle exec rake db:ceate RAILS_ENV=test
➜ bundle exec rake db:migrate RAILS_ENV=test
But when I ran it in development, only the last migration or beginning from a drop database after executing firs migration I get this:
➜ bundle exec rake db:migrate -- --trace
== 20191112204156 MyNewModel: migrating ==============================
-- create_table(:global_clients)
-> 0.0121s
== 20191112204156 MyNewModel: migrated (0.0122s) =====================
rake aborted!
SystemStackError: stack level too deep
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I'm using ruby 2.1.6, and mysql 0.318 and later 0.4.10, I did rvm implode to start it again and nothing happens. I do not know how to solve it, even I do not know how to debug it. So any tips will be good.
It's a problem with dthe difference from rais test and development environments

Heroku deployment rake db:create/migrate error

I am following Hartl's ROR tutorial and I am trying to get my DB working on Heroku, but to no avail. When I run the following commands:
heroku run rake db:create
or
heroku run rake db:migrate
I get the following errors:
Running `rake db:create` attached to terminal... up, run.5477
/usr/bin/env: ruby2.2: No such file or directory
Running `rake db:migrate` attached to terminal... up, run.5562
/usr/bin/env: ruby2.2: No such file or directory
I am using postgresql for development and production. Here is my latest commit https://github.com/Euklidian-Space/sample-app
Here are the heroku logs:
2015-07-30T16:42:48.956556+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by gabriel.grover#gmail.com
2015-07-30T16:42:53.039994+00:00 heroku[run.5562]: Awaiting client
2015-07-30T16:42:53.090027+00:00 heroku[run.5562]: Starting process with command `bundle exec rake db:migrate`
2015-07-30T16:42:53.343439+00:00 heroku[run.5562]: State changed from starting to up
2015-07-30T16:42:55.633768+00:00 heroku[run.5562]: State changed from up to complete
2015-07-30T16:42:55.618985+00:00 heroku[run.5562]: Process exited with status 127
In your bin/bundle, bin/rake, bin/rails and bin/setup files, the first line of each reads #!/usr/bin/env ruby2.2. Change them all to #!/usr/bin/env ruby. Then try deploying again.

heroku run rake db:migrate error “/usr/bin/env: ruby2.2: No such file or directory”

I'm brand new to Rails and I'm following this tutorial. I successfully pushed my app to heroku, but I can't get the database migrate.
I use a virtual machine with ubuntu server .
I typed:
$ heroku run rake db:migrate
and got this error:
Running `rake db:migrate` attached to terminal... up, run.3356
/usr/bin/env: ruby2.2: No such file or directory
I don't understand what I can do. I tried to use
$ heroku run rails db:migrate
$ rake rails:update:bin
but it didn't help.
the solution that worked for me is that for every file in the bin directory of my project, i changed the first line from:
#!/usr/bin/env ruby2.2
to
#!/usr/bin/env ruby

Precompiling assets with capistrano gives error during deployment

I am trying to deploy my rails app to a digital ocean server using the capistrano gem, and I'm getting the error :
The deploy has failed with an error: #<SSHKit::Command::Failed: RAILS_ENV= bundle exec rake assets:precompile exit status: 256
RAILS_ENV= bundle exec rake assets:precompile stdout: Nothing written
RAILS_ENV= bundle exec rake assets:precompile stderr: rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
Even though the local config/database.yml and shared/config/database.yml file on the server are both configured, and have production databases set.
In case I run the rake db:create command on the server, it does create the database successfully. So, can't really find the issue.
Using rails 4.0.2, ruby 2.1.0, capsitrano 3.1.0
Sorry - I don't have the rep to comment.
It's a bit short on detail about your deploy configuration, you probably need to share.
RAILS_ENV= bundle exec rake assets:precompile stdout: Nothing written
Would suggest to me that there is no RAILS_ENV set. I don't think there is an issue with the database .yml
Infact - this post might be relevant: Capistrano 3, Rails 4, database configuration does not specify adapter

Rake aborted! uninitialized constant knowit

I am standing up a new Ubuntu server running MySQL. I have Capistrano set up on my development server and am trying to deploy:cold after running deploy:setup. After the deploy script tries to run
executing "cd /home/adm1n/www/knowit/releases/20121112152400 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
I keep getting this message:
Rake Aborted!
uninitialized constant knowit
Tasks: TOP => environment
Any idea where this constant would be defined? This project is almost entirely new (rails new app Blah). Any suggestions on how I should attempt to troubleshoot this? Thx.
I'm running:
Rake 0.9.2.2
Ruby 1.9.3p194
Capistrano 2.13.5
Bundler 1.1.5
Rails 3.2.8
rvm 1.15.7
UPDATE: knowit is the name of my app. So there apparently there is something not initializing. Not sure where how to troubleshoot this.
UPDATE: Here is my routes.rb file (very basic)
Knowit::Application.routes.draw do
match ':controller(/:action(/:id))(.:format)'
end

Resources