Bundle install json安装失败

发布于 2024-12-22 14:03:27 字数 1288 浏览 2 评论 0原文

我在这里使用 ruby​​ on Rails 教程:

http://ruby.railstutorial.org/chapters/建模和查看用户-one#top

我在使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野味少女 2024-12-29 14:03:27

在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文