OC

Knowledge OS
登录 注册
全部话题 移民 创业 iOS Mac Objective-C Swift Android 招聘 求职

sudo gem install json遭遇如下的错误信息何解呢?

tinyfool
tinyfool 发布于 2014年06月11日 | 更新于 2014年06月12日
无人欣赏。

Mac OS X 10.10,安装有Xcode5 和 Xcode 6 beta,command line tools选的是Xcode 5的,我是Ruby初学者

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/2.0/usr/bin/ruby extconf.rb
creating Makefile
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
 ^
1 error generated.
make: *** [generator.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
共28条回复
楼长 ·
liprais 回复于 2014年06月11日

xcode 6 command line tools 装了没?

2楼 ·
tinyfool 回复于 2014年06月11日

1楼 @liprais 还有Xcode 5,目前Command line tools选的是Xcode 5的

3楼 ·
liprais 回复于 2014年06月11日

2楼 @tinyfool 啊,主题有写,我没看见. 然后我的10.9上也没有这个文件,所以就不知道怎么回事了 在osx上用ruby 建议用rvm,链接在这里: http://rvm.io

4楼 ·
tinyfool 回复于 2014年06月11日

3楼 @liprais 没有,你问了以后我才更新到主题上的。

话说RVM专门是为了解决这类版本混乱问题出现的么?

5楼 ·
xuan_lengyue 回复于 2014年06月11日

建议用 RVM 或者 rbenv,这两者安装 gem 都是无需 sudo 的,ruby 版本和 gemset 也比较好控制。

6楼 ·
tinyfool 回复于 2014年06月11日

5楼 @xuan_lengyue RVM安装了,但是还是有点问题,我感觉是我机器上面有不同的ruby,然后混乱了

7楼 ·
tinyfool 回复于 2014年06月11日

使用RVM安装发现了新的问题

Error running 'requirements_osx_brew_update_system ruby-2.1.2',
showing last 15 lines of /Users/tinyfool/.rvm/log/1402459044_ruby-2.1.2/update_system.log
 https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.'
++ rvm_pretty_print stderr
++ case "${rvm_pretty_print_flag:=auto}" in
++ case "${TERM:-dumb}" in
++ case "1ドル" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'Failed to update Homebrew, follow instructions here:
 https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.n'
Failed to update Homebrew, follow instructions here:
 https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.
++ return 1
Requirements installation failed with status: 1.
8楼 ·
tinyfool 回复于 2014年06月11日

但是brew update也报错,唉,简直就是俄罗斯套娃错误啊

brew update
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
9楼 ·
liprais 回复于 2014年06月11日

搜到了这个 https://gist.github.com/chrisb/4d6a09c6cc1ca2e1b14e 目测是因为homebrew 还在用ruby 1.8而10.10上没有1.8导致的问题...总之还是要装xcode 6 command line tools

10楼 ·
wwwjfy 回复于 2014年06月11日

8楼 @tinyfool Yosemite的ruby是2.0,把1.8改成Current或者2.0就能用,或者ln一个1.8... 还有别的文件有可能要改

本帖有28个回复,因为您没有注册或者登录本站,所以只能看到本帖的10条回复。如果想看到全部回复,请注册或者登录本站。
登录 或者 注册

相关新闻

[顶 楼]
|
|
[底 楼]
|
|
[首 页]

AltStyle によって変換されたページ (->オリジナル) /