heroku运行rake db:migrate失败

时间:2013-08-11 02:16:23

标签: ruby-on-rails heroku pg

我正在尝试在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

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

1 个答案:

答案 0 :(得分:0)

你可以使用这段代码

heroku run:detached rake db:migrate

它会起作用。 在运行最终代码之前,请确保ADD,COM​​MIT和PUSH。

直接转到您的项目

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

然后运行最终代码

heroku run:detached rake db:migrate