简体   繁体   English

Ruby on Rails:无法安装JSON gem

[英]Ruby on Rails: Can't install JSON gem

When I try to create a new Rails application rails new app , the process stops when trying to install the JSON gem. 当我尝试创建新的Rails应用程序rails new app时,尝试安装JSON gem时该过程停止。 So, I tried to install it alone, using: 因此,我尝试使用以下命令单独安装它:

gem install json

but I get the following error message: 但我收到以下错误消息:

Building native extensions.  This could take a while...
ERROR:  Error installing json:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
creating Makefile

make
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.0 -I. -DJSON_GENERATOR  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c generator.c
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [generator.o] Error 1

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.6 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

Do you have any idea what does this mean? 你知道这是什么意思吗? and how can I fix it? 以及如何解决?

Some additional information: I'm using MacOSX, the Rails version is 3.2.11. 一些其他信息:我正在使用MacOSX,Rails版本是3.2.11。 and the Ruby version is 1.8.7. Ruby版本是1.8.7。

Thanks for your help. 谢谢你的帮助。

Isn't support for Ruby 1.8.X dropped in Rails? Rails中不支持Ruby 1.8.X吗? I recommend upgrading to 1.9.3. 我建议升级到1.9.3。 For your gem: if there are problems with the native extensions, try using the "`json-pure" gem instead, since it's written entirely in ruby and doesn't need the native extensions. 对于您的gem:如果本机扩展存在问题,请尝试使用“`json-pure” gem,因为它完全是用ruby编写的,不需要本机扩展。

http://rubygems.org/gems/json_pure http://rubygems.org/gems/json_pure

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM