【问题标题】:heroku run rake db:migrate failsheroku 运行 rake db:迁移失败
【发布时间】:2013-08-11 02:16:23
【问题描述】:

我正在尝试在 Heroku 上迁移我的 postgresql 数据库。当我运行“heroku run rake db:migrate failed”时,我收到了这个错误:

Running `rake db:migrate` attached to terminal... up, run.4898                                                       
/usr/bin/env: ruby1.9.1: No such file or directory

当我运行“heroku run ruby​​ -v”时:

Running `ruby -v` attached to terminal... up, run.9649                                                               
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]

这是我的 gemfile:

source 'https://rubygems.org'

ruby '2.0.0' 

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Heroku
gem 'rails_12factor', group: :production

# Devise Authenticaiton
gem 'devise'

# Omniauth Support
gem "omniauth"
gem 'omniauth-facebook'
gem 'omniauth-twitter'

# Faker gem to generate fake data
gem 'faker'

# Whenver gem to manage cron jobs
gem 'whenever', :require => false

# Bootstrap paginate support
gem 'bootstrap-will_paginate', :git => 'git://github.com/yrgoldteeth/bootstrap-    will_paginate.git'

# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: :development

# Postgresql for Heroku
gem 'pg', group: :production

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'jquery-ui-rails'

# Turbolinks makes following links in your web application faster. Read more:     https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
 gem 'debugger', group: [:development, :test]

group :development do
  gem 'better_errors'
  gem 'binding_of_caller'
end

感谢您抽出宝贵时间阅读本文。

【问题讨论】:

标签: ruby-on-rails heroku pg


【解决方案1】:

你可以改用这个代码

heroku run:detached rake db:migrate

它会起作用的。 确保在运行最终代码之前添加、提交和推送。

直接转到您的项目所在的位置

$ git add .
$ git commit -m "heroku repo"
$ git push heroku master

然后运行最终代码

heroku run:detached rake db:migrate

【讨论】:

    猜你喜欢
    • 2011-08-05
    • 1970-01-01
    • 1970-01-01
    • 2012-02-24
    • 1970-01-01
    • 2014-02-13
    • 2012-06-16
    • 2012-12-09
    相关资源
    最近更新 更多