Bundle install json安装失败
我在这里使用 ruby on Rails 教程:
我在使用bundle exec rake db:migrate 命令时遇到了问题。它说
在任何源中都找不到 json-1.6.3。
所以我使用了命令 gem install json -v '1.6.3' ,一切似乎都工作正常。然后我尝试再次运行 bundle exec rake db:migrate
,但失败并显示相同的消息,找不到 json。
我相信问题的线索是,当我使用命令 bundle install
时,尝试安装 json 1.6.3 时会弹出此消息:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/chuckyuan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
creating Makefile
make
Makefile:148: *** target pattern contains no `%'. Stop.
Gem files will remain installed in /Users/chuckyuan/Documents/rails_projects/sample_app/db:migrate/ruby/1.9.1/gems/json-1.6.3 for inspection.
Results logged to /Users/chuckyuan/Documents/rails_projects/sample_app/db:migrate/ruby/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.6.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.3'` succeeds before bundling.
当我创建一个新的 Rails 项目并运行相同的命令时,一切正常。预先感谢您的帮助。
I'm using the ruby on rails tutorial here:
http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-one#top
and I ran into problems when using the bundle exec rake db:migrate command. It said
Could not find json-1.6.3 in any of the sources.
So I used the command gem install json -v '1.6.3'
, and everything seemed to work fine. Then I tried running bundle exec rake db:migrate
again, and it failed with the same message, could not find json.
I believe a clue to the problem is that when I use the command bundle install
, this message pops up when trying to install json 1.6.3:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/chuckyuan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
creating Makefile
make
Makefile:148: *** target pattern contains no `%'. Stop.
Gem files will remain installed in /Users/chuckyuan/Documents/rails_projects/sample_app/db:migrate/ruby/1.9.1/gems/json-1.6.3 for inspection.
Results logged to /Users/chuckyuan/Documents/rails_projects/sample_app/db:migrate/ruby/1.9.1/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
An error occured while installing json (1.6.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.6.3'` succeeds before bundling.
When I create a new rails project and run the same commands, everything works. Thanks in advance for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Ruby 1.8.7 上,您需要安装 gem。然而,在 Ruby 1.9.2 中,json gem 与核心 Ruby 发行版捆绑在一起。因此,如果您使用的是 1.9.2,那么您可能已经准备就绪。如果您使用的是 1.8.7,则需要安装 gem。
On Ruby 1.8.7, you'll need to install a gem. However, in Ruby 1.9.2, the json gem is bundled with the core Ruby distribution. So, if you're using 1.9.2, you're probably all set. If you're on 1.8.7, you'll need to install a gem.