already initialized constant RUBY: heroku rake db:

2020-07-13 11:05发布

问题:

I trying to do a full verification install of Rails 3.1 pre and deploy to heroku.

heroku rake db:migrate fails with already initialized constants RUBy and LN_SUPPORTED but the error messages indicate that both 1.9.2 and 1.9.1 are both running.

/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
rake aborted!
Invalid DATABASE_URL
(erb):9:in `rescue in <main>'
(erb):6:in `<main>'
/usr/ruby1.9.2/lib/ruby/1.9.1/erb.rb:753:in `eval'
/usr/ruby1.9.2/lib/ruby/1.9.1/erb.rb:753:in `result'
/app/.bundle/gems/ruby/1.9.1/gems/railties-3.1.0.rc4/lib/rails/application/configuration.rb:95:in `database_configuration'
...
...

My test_app runs fine with local db

I have no working experience with Heroku yet. I have just pushed files out there.

回答1:

  • Add the required gems to your Gemfile

    • pg (heroku uses postgress)
    • execjs
    • therubyracer
  • Make sure you also push your Gemfile.lock file



回答2:

Have you solved your problem?

This might be what David mentioned: you need to specify these gems for Heroku deployment. Make sure your Gemfile and Gemfile.lock is not included to your .gitignore file.

Also you may wanna use Cedar stack on Heroku for. Make sure you used: heroku create --stack cedar instaed of heroku create for a Rails3 app. If it's Rails3.1 then it needs further readings: http://devcenter.heroku.com/articles/rails31_heroku_cedar

Try http://ruby.railstutorial.org/ this book for free walkthrough on Heroku deployment. You can contact to Heroku's support too.
If you've further question on it please insert your error, Gemfile, Gemfile.lock here (or into Guhub's Gist) and share it.
HTH

Just noticed: you probably don't use RVM and you may have problems with Rake and other gem versions too. Please see RVM: https://rvm.io