1

我遇到过的最难的错误——希望大家帮忙!(仍在学习和初学者)。

我之前尝试在 Heroku 上部署,但现在我的应用程序无法在 Heroku 和本地运行。

现在尝试仅修复本地情况。

我更改的其他内容是 database.yml 文件。它现在全部使用 postgresql,但在我的 GemFile 中,我指定 sqlite3 进行测试。

rails s
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
    from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
    from /usr/bin/rails:18

我的宝石文件:

source 'https://rubygems.org'

#ruby '2.0.0'

gem 'rails', '3.2.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development, :test do
    gem 'sqlite3'
end

group :production do
    gem 'pg'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

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

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'paperclip'

bundle install并收到以下消息(我必须从这条消息中做任何事情吗?):

根据您的 ruby​​ 版本,您可能需要安装 ruby​​ rdoc/ri 数据:

Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rdoc:
<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Post-install message from paperclip:
##################################################
#  NOTE FOR UPGRADING FROM PRE-3.0 VERSION       #
##################################################

Paperclip 3.0 introduces a non-backward compatible change in your attachment
path. This will help to prevent attachment name clashes when you have
multiple attachments with the same name. If you didn't alter your
attachment's path and are using Paperclip's default, you'll have to add
`:path` and `:url` to your `has_attached_file` definition. For example:

    has_attached_file :avatar,
      :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
      :url => "/system/:attachment/:id/:style/:filename"
4

1 回答 1

2

而不是运行

rails s

bundle exec rails s

确保您使用的是 Gemfile 中引用的 gem,而不是本地 gem。

于 2013-08-20T15:49:51.167 回答