1

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

这是我的宝石文件:

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

感谢您抽出时间来阅读。

4

1 回答 1

0

你可以改用这个代码

heroku run:detached rake db:migrate

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

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

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

然后运行最终代码

heroku run:detached rake db:migrate
于 2015-04-18T16:18:31.037 回答