无法生成模型:“您已经激活了multi_json 1.7.2,但您的Gemfile需要multi_json 1.4.0”

时间:2013-04-10 20:24:43

标签: ruby-on-rails gemfile

这是我投入的内容:

$ rails generate scaffold Foobar content:string

这是我得到的:

/Users/nsbarr/.rvm/gems/ruby-1.9.3-p286@rails3tutorial2ndEd/gems/bundler-1.2.1/lib/bundler/runtime.rb:31:in `block in setup': You have already activated multi_json 1.7.2, but your Gemfile requires multi_json 1.4.0. Using bundle exec may solve this. (Gem::LoadError)
from /Users/nsbarr/.rvm/gems/ruby-1.9.3-p286@rails3tutorial2ndEd/gems/bundler-1.2.1/lib/bundler/runtime.rb:17:in `setup'
from /Users/nsbarr/.rvm/gems/ruby-1.9.3-p286@rails3tutorial2ndEd/gems/bundler-1.2.1/lib/bundler.rb:116:in `setup'
from /Users/nsbarr/.rvm/gems/ruby-1.9.3-p286@rails3tutorial2ndEd/gems/bundler-1.2.1/lib/bundler/setup.rb:7:in `<top (required)>'
from /Users/nsbarr/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/nsbarr/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/nsbarr/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from /Users/nsbarr/rails_projects/poems_io/config/boot.rb:7:in `<top (required)>'
from /Users/nsbarr/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/nsbarr/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from script/rails:5:in `<main>'

我正在使用Michael Hartl的Rails教程。这是我的Gemfile: 来源'https://rubygems.org'

gem 'rails', '3.2.8'

gem 'twilio-ruby'

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


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
end

gem "twitter-bootstrap-rails"
gem 'less-rails-bootstrap', '2.0.6'
gem 'jquery-rails', '2.0.2'
gem "therubyracer"

group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
end

gem 'annotate', '2.5.0', group: :development

group :production do
end

group :production do
  gem 'pg'
end

我以前能够在这个应用程序上生成模型,所以我不确定过渡期间发生了什么。通过搜索错误消息无法找到任何内容。谢谢你的指导!

1 个答案:

答案 0 :(得分:2)

运行以下命令,一切正常:

bundle exec rails generate scaffold Foobar content:string