1

运行时:

heroku run rake db:migrate

我返回错误:

Running `rake db:migrate` attached to terminal... up, run.1
rake aborted!
no such file to load -- devise

这是我在 application.rb 文件顶部的“require 'devise'”行中看到的错误。以前(没有这一行),我在运行 heroku run rake db:migrate 时返回一个不同的错误,说“未初始化的常量设计”。

我的应用程序在本地运行良好。我似乎找不到其他有同样问题的人,所以任何线索将不胜感激!

(编辑):添加 Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'

group :development do

gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.9.0'
gem 'guard-rspec', '0.5.5'
gem 'devise'
gem 'omniauth-linkedin'
gem 'nifty-generators', :group => :development
gem 'debugger'
gem 'linkedin', :git => "git://github.com/pengwynn/linkedin.git"

end 

group :assets do

gem 'sass-rails', '3.2.4'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
gem 'jquery-rails'#, '2.0.0'

end

group :test do

gem 'rspec-rails', '2.9.0'
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.4.3.1', :require => false
gem 'growl', '1.0.3'
gem 'guard-spork', '0.3.2'
gem 'spork', '0.9.0'

end

group :production do

gem 'pg', '0.12.2'

end

gem "mocha", :group => :test
4

1 回答 1

3

问题是:Heroku 在没有开发或测试组的情况下编译您的 gem 文件。

要修复它,只需从这里获取您需要的内容:

group :development do

gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.9.0'
gem 'guard-rspec', '0.5.5'
gem 'devise'
gem 'omniauth-linkedin'
gem 'nifty-generators', :group => :development
gem 'debugger'
gem 'linkedin', :git => "git://github.com/pengwynn/linkedin.git"

end 

并将其移动到开发或测试组之外的任何地方,如下所示:

group :development do

gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.9.0'
gem 'guard-rspec', '0.5.5'
gem 'omniauth-linkedin'
gem 'nifty-generators', :group => :development
gem 'debugger'
gem 'linkedin', :git => "git://github.com/pengwynn/linkedin.git"

end 

gem 'devise'
于 2012-07-18T14:54:57.527 回答